microsoft / vscode-jupyter

VS Code Jupyter extension
https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter
MIT License
1.3k stars 293 forks source link

Python data viewer does not support grouped columns (custom indices), Multi-index , PeriodIndex #1144

Open p5ydn0 opened 4 years ago

p5ydn0 commented 4 years ago

Bug: Notebook Editor, Interactive Window, Editor cells

Steps to cause the bug to occur

When run below code:

import numpy as np
import pandas as pd

# data is from kaggle Titanic Competition
data_train = pd.read_csv('data/train.csv')

g = data_train.groupby(['SibSp','Survived'])
df1 = pd.DataFrame(g.count()['PassengerId'])
df2 = pd.DataFrame(g.count()['Pclass'])
print(df)

the python interactive variables function can't achieve(display) the expected groupby effect.

the expected effect is like this(below is in Spyder):

image

but the VSCode variables effect is this:

image

Your Jupyter and/or Python environment

Please provide as much info as you readily know

Developer Tools Console Output

Microsoft Data Science for VS Code Engineering Team: @rchiodo, @IanMatthewHuff, @DavidKutu, @DonJayamanne, @greazer

rchiodo commented 4 years ago

Sorry but not sure what you're asking for here? Did you want column reordering?

We do support sorting by different columns, you just can't move them around.

p5ydn0 commented 4 years ago

Sorry but not sure what you're asking for here? Did you want column reordering?

We do support sorting by different columns, you just can't move them around.

Thank you for your reply.

I am not going to sort, but to group by the two columns of SibSp and Survived; you can notice the first two columns in the picture expected to be displayed correctly, that is the result I expect; and the display of these two columns in VSCode is the "garbled" content in the index below (or not displayed).

aeryen commented 2 years ago

bump this, the current data viewer seems have poor support for multi-index.