Scaling euler number in Pandas Column

350 views Asked by At

I have a pandas dataframe with one column that has euler numbers inside.

E.g.

5.589918e+08    
5.572475e+08
8.639290e+09

Whats the best way to scale the whole column to normal numbers?

1

There are 1 answers

1
Rik Kraan On BEST ANSWER

This is the scientific notation of Pandas and is it's way of dealing with very large or small floats.

Although not necessary, multiple methods exist if you wish to convert your floats to another format:

1. use apply()

df.apply(lambda x: '%.5f' %x, axis=1)

2. set the global options of pandas

pd.set_option('display.float_format', lambda x: '%.5f' %x)

3. use df.round(). This only works if you have very small numbers with a lot of dcimals

df.round(2)