我有一個看起來像這樣的表:

平均行和總行的計算方式如下:
df1.loc["Average"] = df1.mean()
df1.loc["Total"] = df1.sum()
現在,我意識到這里的問題是平均值計算正確,但總和也包括平均值行,這不是我想要的。
理想情況下,我希望看到更像是已sum()應用于的單個 .loc 行
`columns` ['Enageable R', 'R Responses', 'R Response Rate', 'Engageable Q',
'Q Responses', 'Q Response Rate']
并mean()應用于columns ['R Response Rate', 'Q Response Rate']
所以我很想看到這樣的事情:
| 牌 | 可參與的 R | R 回應 | 反應速度 |
|---|---|---|---|
| 品牌1 | 34 | 34 | 100.00% |
| 品牌2 | 34 | 34 | 100.00% |
| 品牌3 | 34 | 34 | 100.00% |
| 全部的 | 102 | 102 | 100.00% |
uj5u.com熱心網友回復:
使用
所以總和和平均列在其他行的計算中不相互包含。
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/371338.html
