Normalisasi kolom di panda DataFrame
In [5]: %paste
cols = ['2002', '2003', '2004', '2005']
df[cols] = df[cols] / df[cols].sum()
## -- End pasted text --
In [6]: df
Out[6]:
term 2002 2003 2004 2005
0 climate 0.043478 0.454545 0.333333 0.466667
1 global 0.521739 0.500000 0.666667 0.400000
2 nuclear 0.434783 0.045455 0.000000 0.133333
Worried Wren