I have a DataFrame through which I would like to calculate percentages; however, when attempting to do so, python spits back either 0 or 1.
For example, columns OIR.a1.d.bull
and OIR.a1r1.d
are arrays filled with 1s and 0s.
>>> data['OIR.a1.d.bull'].sum()
653
>>> data['OIR.a1r1.d'].sum()
320
>>> den = data['OIR.a1.d.bull'].sum()
>>> num = data['OIR.a1r1.d'].sum()
>>> den
653
>>> num
320
>>> num / den
0
I expect to see - roughly - the following.
>>> num / den
0.49004594