'Pivottable (2 levels) NaN not showing
I have a dataframe, which I create from another dataframe:
df_exp_fix = df_aus[df_aus['CATEGORY'] == "Fixkosten"]
When I display df_exp_fix i get:
| MONTHYEAR | Comment | LEVEL2 | LEVEL3 | AMOUNT | |
|---|---|---|---|---|---|
| 0 | 01.01.2022 | bla | Lebensmittel | Metro | 10 |
| 1 | 01.02.2022 | bla | Taschengeld | NaN | 10 |
Next I do
table_exp_fix = df_exp_fix.pivot_table(values='AMOUNT', index=['LEVEL2', 'LEVEL3'],
columns=['MONTHYEAR'], aggfunc=np.sum, margins=True)
But the Line "Taschengeld" is not displayed? And with that all Sums are not the same if I only aggregate on LEVEL2
I played around with dropna.... and other parameters but it doesn't get displayed
Any help?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
