Home > OS >  How to interpolate based on previous behaviour python?
How to interpolate based on previous behaviour python?

Time:06-30

I have a DataFrame tracking Temperatures based on time. it looks like this : 1

For a few days there was a problem and it shows 0 so the plot looks like this: 2

I have replaced the 0 with nans and then used interpolate method but the result is not what I need even I used method = time I get this: 3

So how can I use a customised interpolation or something to correct this based on previous behaviour? Thank you

CodePudding user response:

I would not interpolate. I would just take N elements before the gap and after, compute the average temperature and fill the gap with random values using a normal distribution around the average value (and you can use the std too)

CodePudding user response:

The variances between the frames indicates true variable values missing or not calculated within the set range. <1,2/,3,...?>="unknown""unknowns"/^@'table'/open(set)

  • Related