I use pandas occasionally to read excel files.
I found out that I can also use it to calculate subtotals
using group(...). Works fine. Except when i print the result
of the subtotal after grouping, it displays 0,1... on top,
are these indexes? Example sites don't seem comment on that,
so I must be missing something. What ?
thx,
Paul
I found out that I can also use it to calculate subtotals
using group(...). Works fine. Except when i print the result
of the subtotal after grouping, it displays 0,1... on top,
are these indexes? Example sites don't seem comment on that,
so I must be missing something. What ?
thx,
Paul
import pandas as panda Q = [['AF-10', 744.42], ['AF-10', 1243.68], ['AF-20', 90.0], ['BA-40', -1425.0], ['BA-40', 1425.0], ['BA-40', 1425.0], ['BA-40', 1425.0], ['BA-50', 150.0], ['BO-30', 16514.61], ['BR-10', 528.35]] # etc.... Qdf = panda.DataFrame(Q) print(Qdf.groupby([0]).sum())
Output: 1
0
AF-10 1988.10
AF-20 90.00
BA-40 2850.00
BA-50 150.00
BO-30 16514.61
BR-10 528.35
It is more important to do the right thing, than to do the thing right.(P.Drucker)
Better is the enemy of good. (Montesquieu) = French version for 'kiss'.
Better is the enemy of good. (Montesquieu) = French version for 'kiss'.