Open pwwang opened 2 years ago
We can fix this, instead of checking whether the type is dataframe we need to check if the type inherits dataframe. This information needs to come from Python instead of us trying to determine this in node based on the type value.
@DonJayamanne Thanks! Should we submit an issue with the Python extension? I am not sure how it is supposed to work.
This is an issue in this extension, hence the issue belongs here.
The issue still appears in the latest version of VSCode 1.75.1
Closing this issue as fixed, I just tested this and it works Please feel free to ping here with a sample code if this doesn't work, or feel free to create a new issue Here's what I tried
from pandas import DataFrame
class MyDF(DataFrame):
...
pd_df = DataFrame(dict(a=[1,2,3,4], b=[5,6,7,8]))
pd_df1 = MyDF(dict(a=[1,2,3,4], b=[5,6,7,8]))
With the same code example @pw provided, I still don't see MyDF treated the same as a pandas DataFrame, there is an icon next to the name (highlighted in red) and Size appear to be different when inspecting Variables.
from pandas import DataFrame
class MyDF(DataFrame):
...
pd_df = DataFrame(dict(a=[1,2,3]))
my_df = MyDF(dict(a=[1,2,3]))
I can still replicate this issue.
Applies To
What happened?
A standard pandas data frame, which is an instance of
pandas.DataFrame
, is able to be expanded in the data viewer. However, an instance ofpandas.DataFrame
subclass is not.VS Code Version
1.64.2
Jupyter Extension Version
v2022.1.1301854968
Jupyter logs
No response
Coding Language and Runtime Version
Python 3.9.5 (pandas 1.4.1)
Language Extension Version (if applicable)
Python v2022.2.1924087327
Anaconda Version (if applicable)
No response
Running Jupyter locally or remotely?
Remote