Houmes
Houmes

Reputation: 71

How to suppress scientific notation in values in a pandas dataframe?

I have pandas.DataFrame that contains some values with scientific notation and I want to change those values to a normal value without the e+...

import pandas as pd
df = pd.DataFrame(
    [7.70000e+05, 4.5000000e+09, 3.219500e+05, 25000, 476577], 
    columns = ['Price'])

Upvotes: 1

Views: 374

Answers (1)

Pablo C
Pablo C

Reputation: 4761

You can try something like this:

pd.set_option("float_format", lambda x: f"{x:.2f}")
df
          Price
0     770000.00
1 4500000000.00
2     321950.00
3      25000.00
4     476577.00

Upvotes: 1

Related Questions