soluentre / pandaspro

0 stars 0 forks source link

【VERY URGENT】BIG PROJECT - pivot_table enhancement #13

Open soluentre opened 4 months ago

soluentre commented 4 months ago

refer to comments below

soluentre commented 2 months ago

result, rename_mapper = ... pivot_table() result = result[keeplist] result = result.rename(rename_dict)

note: when using the add_percentage para, it will return a tuple (df, rename_dict)

pivot_table(index=['country', 'var'], columns='us_nonus', subtotal={'country': 'Top', 'var': 'Bottom'}, add_percentage={'US':'column', 'Non-US': 'column'}, add_column_percentage=['US', 'Non-US'])