0

I'm currently scrubbing some numbers and converting numbers if they are 66.1K to be 66100 using

df['number'].replace({'[kK]': '*1e3', '[mM]': '*1e6', '[bB]': '*1e9', },regex=True).map(pd.eval)

can replicate by just doing a simple print(pd.eval('64.1*1e3'))

However the return for 64.1K is 64099.99999999999.

Does anyone know why this happens? How would you use pandas to get 64100.0?

I have tested with 65.1K and it is the same result 65099.99999999999 but if I do 66.1K it equals to 66100.0.

Grzegorz Skibinski
  • 12,624
  • 2
  • 11
  • 34
I eat toast
  • 117
  • 6

0 Answers0