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

Pandas 2.1.1 Subtotal Dropping Index Names #27

Open
keg5038 opened this issue Sep 25, 2023 · 3 comments
Open

Pandas 2.1.1 Subtotal Dropping Index Names #27

keg5038 opened this issue Sep 25, 2023 · 3 comments

Comments

@keg5038
Copy link

keg5038 commented Sep 25, 2023

Hello!
Love the project, @chris1610! I have upgraded Pandas to 2.1.1 & Sidetable is now behaving differently in a couple of areas.

Before the upgrade to 2.1.1, I could call x.stb.subtotal & it would keep the index names. Now, it looks like it is dropping the index names from my multi-level index. Any suggestions?

@chris1610
Copy link
Owner

I've finally started to take a look at this and can not reproduce. Can you recreate with the seaborn titanic data:

df = sns.load_dataset('titanic')
df.groupby(['sex', 'class']).agg({'fare': ['sum']}).stb.subtotal()

When I execute the above, I get a deprecation warning but don't think that's the issue you're seeing.

@keg5038
Copy link
Author

keg5038 commented Sep 30, 2023

Thanks, @chris1610! I just installed an updated conda environment which defaults to pandas '2.0.3'.

In running your code above, it drops the index names ('sex','class') when you add in the stb.subtotal. I've included pics of both here.

Subtotal
No subtotal

@chris1610
Copy link
Owner

Ah. Got it. I'll look into that.. Thanks for the example.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants