我有以下一系列数据:
s = pd.Series({
(0, 'InData'): 2944.51697, (0, 'InInterests'): 3703.208935,
(1, 'InData'): 6207.58004, (1, 'InInterests'): 3505.068411,
(2, 'InData'): 8133.00273, (2, 'InInterests'): 3735.028306,
(3, 'InData'): 9426.70471, (3, 'InInterests'): 2665.989291,
(4, 'InData'): 2604.1578, (4, 'InInterests'): 3103.310729,
(5, 'InData'): 6784.82916, (5, 'InInterests'): 3293.815375,
(6, 'InData'): 6823.6174, (6, 'InInterests'): 4121.83398,
(7, 'InData'): 4072.70277, (7, 'InInterests'): 3033.609368,
(8, 'InData'): 4614.60824, (8, 'InInterests'): 2955.216811,
(9, 'InData'): 6986.50075, (9, 'InInterests'): 2986.820394
}, name='KilobytesRaw').rename_axis(index=['Node', 'Type'])
s
:
Node Type
0 InData 2944.516970
InInterests 3703.208935
1 InData 6207.580040
InInterests 3505.068411
2 InData 8133.002730
InInterests 3735.028306
3 InData 9426.704710
InInterests 2665.989291
4 InData 2604.157800
InInterests 3103.310729
5 InData 6784.829160
InInterests 3293.815375
6 InData 6823.617400
InInterests 4121.833980
7 InData 4072.702770
InInterests 3033.609368
8 InData 4614.608240
InInterests 2955.216811
9 InData 6986.500750
InInterests 2986.820394
Name: KilobytesRaw, dtype: float64
我想要计算InData
和InInterests
的总和,但在Pandas的索引页和Google上都找不到这种情况。因此,我希望我的结果如下:
Node
0 6647.725905
1 9712.648451
...
9 9973.321144