相关疑难解决方法(0)

Python(Pandas)在每个lvl的多索引数据帧上添加小计

假设我有以下数据帧:

a       b       c      Sce1     Sce2    Sce3    Sce4    Sce5    Sc6
Animal  Ground  Dog    0.0      0.9     0.5     0.0     0.3     0.4  
Animal  Ground  Cat    0.6      0.5     0.3     0.5     1.0     0.2 
Animal  Air     Eagle  1.0      0.1     0.1     0.6     0.9     0.1 
Animal  Air     Owl    0.3      0.1     0.5     0.3     0.5     0.9     
Object  Metal   Car    0.3      0.3     0.8     0.6     0.5     0.6 
Object  Metal   Bike   0.5      0.1     0.4     0.7     0.4     0.2 
Object  Wood    Chair  0.9      0.6     0.1     0.9     0.2     0.8 
Object  Wood    Table  0.9      0.6     0.6     0.1 …
Run Code Online (Sandbox Code Playgroud)

python group-by subtotal pandas pandas-groupby

5
推荐指数
1
解决办法
2738
查看次数

标签 统计

group-by ×1

pandas ×1

pandas-groupby ×1

python ×1

subtotal ×1