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!!!
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)
NEW ROWS:
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!!!