spyder: Pandas index type can't be viewed in variable viewer
Hi, it seems that certain (Int64Index in this case) built-in pandas.Index don’t work with the variable viewer.
I’m unsure if this is unique to Spyder 6 (Windows) or all versions (I’m using the standalone spyder 6 installer), and there could be other index types that dont work that I’m unaware of.
Here is a bit of reproducible code:
import pandas as pd
import datetime as dt
cols = pd.Index(range(5))
index = pd.Index(pd.bdate_range(dt.date.today(),periods=10))
data = {key : [i/1.25 for i in range(10)] for key in cols}
df = pd.DataFrame(data, index = index, columns = cols)
print(f'I work!: {df.columns}')
df.columns = pd.Index([i for i in range(5)])
print(f'I dont work!: {df.columns}')
(PS. Hopefully I dont make myself look silly by ignoring the very direct “dont report to github” message 😃 )
About this issue
- Original URL
- State: open
- Created a year ago
- Comments: 16 (9 by maintainers)
Not totally sure but maybe a mismatch between the installer pandas version and the one you have installed in your custom interpreter env could be causing the dialog to appear. I think the installers come with pandas 2.0.3 and seems like the pandas version related with your custom environment has pandas 1.5.3. Could it be possible for you to update the pandas version in your custom Python interpreter env from 1.5.3 to 2.0.3?
Could it be that the error comes from using a custom interpreter?