Reputation: 61
Hello I have a DataFrame that looks like this. And I want to convert the whole column from a Scientific notation to a Decimal.
And After I convert them to Decimals, I want to convert them into and integer without making them whole numbers.
Please help.
df1 = pd.read_csv('/content/drive/MyDrive/노후교량/DZ_Middle_G/20km_hr_lane1_acc_middle_girder.csv')
df1.head()
output:
DZ_middle_G_L1_20km
0 1.021e-003
1 1.597e-003
2 1.564e-003
3 1.031e-003
4 3.022e-004
So I want my final output to be:
DZ_middle_G_L1_20km
0 0.001021
1 0.001597
2 0.001564
3 0.001031
4 0.0003022
Thank you very much
Upvotes: 0
Views: 881
Reputation: 561
This changes to integer:
pd.set_option('display.float_format', lambda x: '%.7f' % x)
df[list(df.columns)] = df[list(df.columns)].astype('float64').apply(np.int64)
print(df)
Upvotes: 1