Multiple Aggregate Function Over A Pivot Table
how to get the multiple aggregate function over a pivot table of all the columns not by individual columns over the pivot table. here is my pivot table kpi_date 2019-01-01 20
Solution 1:
Using agg
df.agg(['mean','sum','max'])2019-01-01 2019-01-02 2019-01-16 2019-01-17mean8613.473684 8018.263158 8186.578947 8386.578947sum163656.000000152347.000000155545.000000159345.000000max43029.00000040038.00000037599.00000039125.000000
If need all values using stack
df.stack().agg(['max','mean','min'])
max43029.000000
mean 8301.223684min1317.000000
dtype: float64
If need all row
df.T.agg(['mean','sum','max'])
Post a Comment for "Multiple Aggregate Function Over A Pivot Table"