Keithx
Keithx

Reputation: 3148

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!

Upvotes: 0

Views: 175

Answers (2)

Zach S.
Zach S.

Reputation: 128

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

Upvotes: 1

Raza
Raza

Reputation: 215

>>> float(4.536115e+07)
45361150.0

or

>>> f = 4.536115e+07
>>> "%.16f" % f
'45361150.0000000000000000'

Upvotes: 0

Related Questions