HalfPintBoy HalfPintBoy - 1 month ago 5
Python Question

Exponentional values in Python Pandas

Have a case of quite huge numbers in python pandas, so the dataframe looks like this:

trades
4.536115e+07
3.889124e+07
2.757327e+07


How can these numbers be transformed into "normal" values from exponential in pandas?

Thanks!

Answer

You could change the pandas options as such:

>>> data = np.array([4.536115e+07, 3.889124e+07, 2.757327e+07])
>>> pd.set_option('display.float_format', lambda x: '%.f' % x)
>>> pd.DataFrame(data, columns=['trades'])

    trades
0   45361150
1   38891240
2   27573270