Skip to content
Advertisement

Pandas / I can’t format the data after Resample.Interpolate

I have these data coming from a csv file

enter image description here

I did an interpolate with a 5 min period

ecoData = ecoData.resample('5min').interpolate()
ecoData.head()

Here is the result

enter image description here

Then I would like to keep only 2 digits so I did a test on the first column :

ecoData["1/31/2019"].map('{:.2f}'.format)
ecoData.head()

But nothing has changed as a result

Advertisement

Answer

Did you save the result?

ecoData["1/31/2019"] = ecoData["1/31/2019"].map('{:.2f}'.format)
ecoData.head()
User contributions licensed under: CC BY-SA
6 People found this is helpful
Advertisement