2

I have a data frame with a numerical values(float64), I have used the inbuilt (mean,median,mode) function of pandas and chained round function to 4 decimal place, now the result is leading to an exponential value.

print(a.mean().round(4))

result = (4.509534e+09)

Is there a way i can chain a inbuild function/some other solution to convert the value to numerical?

I have tried to convert my result to numerical from this, but it didn't work out.

as Heading specifies i would like a solution for chaining, but not entering a suppressing command at top of code [pd.set_option('display.float_format', lambda x: '%.4f' % x)],

a.[pandas mean/median.mode].apply(lambda x: '%.17f' % x).values.tolist()

only work for mean and median but not for mode. The solution for above was referred from this link

1 Answers1

0

You can use df.style. Try:

df.style.format('{:.4f}')
Mohit Motwani
  • 4,662
  • 3
  • 17
  • 45