Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Data viewer is not recognizing objects of pandas.DataFrame subclass #9264

Open
1 of 2 tasks
pwwang opened this issue Mar 7, 2022 · 7 comments
Open
1 of 2 tasks

Data viewer is not recognizing objects of pandas.DataFrame subclass #9264

pwwang opened this issue Mar 7, 2022 · 7 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug data-viewer variable-explorer

Comments

@pwwang
Copy link

pwwang commented Mar 7, 2022

Applies To

  • Notebooks (.ipynb files)
  • Interactive Window and/or Cell Scripts (.py files with #%% markers)

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 of pandas.DataFrame subclass is not.

image

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

@DonJayamanne
Copy link
Contributor

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.

@pwwang
Copy link
Author

pwwang commented Mar 7, 2022

@DonJayamanne Thanks! Should we submit an issue with the Python extension? I am not sure how it is supposed to work.

@DonJayamanne
Copy link
Contributor

This is an issue in this extension, hence the issue belongs here.

@rleyvasal
Copy link

The issue still appears in the latest version of VSCode 1.75.1

@DonJayamanne
Copy link
Contributor

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]))

@rleyvasal
Copy link

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]))
datar_dataframe_inheritance

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jan 21, 2024
@DonJayamanne
Copy link
Contributor

I can still replicate this issue.

@DonJayamanne DonJayamanne reopened this Jul 22, 2024
@amunger amunger added variable-explorer and removed good first issue Good for newcomers labels Aug 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Issue identified by VS Code Team member as probable bug data-viewer variable-explorer
Projects
None yet
Development

No branches or pull requests

7 participants