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

Suggestion #28

Open
rparente16 opened this issue Oct 8, 2024 · 0 comments
Open

Suggestion #28

rparente16 opened this issue Oct 8, 2024 · 0 comments

Comments

@rparente16
Copy link

rparente16 commented Oct 8, 2024

LOVE this function. Would love even more if there was an option to do nway=True so that it would add all combinations. For example:

CURRENT:
df.groupby(['sex', 'class','city']).agg({'fare': ['sum']}).stb.subtotal(nway=True)

sex class city Count
Female First Melbourne 5
Female First Burbank 10
Female First Female/First Subtotal 15
Female Second Melbourne 3
Female Second Burbank 6
Female Second Female/Second Subtotal 9
Female Female Subtotal 24
Male First Melbourne 10
Male First Burbank 15
Male First Male/First Subtotal 25
Male Second Melbourne 9
Male Second Burbank 3
Male Second Male/Second Subtotal 12
Male Male Subtotal 37

NEW ROWS:

sex class city Count
Female Female/City Subtotal Melbourne 8
Female Female/City Subtotal Burbank 16
Male Male/City Subtotal Melbourne 19
Male Male/City Subtotal Burbank 18
First/Burbank Subtotal First Burbank 25
First/Burbank Subtotal Second Burbank 9

and so on ...

Proc Means in SAS does this and it's such a headache to code in Python. WOULD love if you added it!!!

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

1 participant