I have the following second-resolution dataframe:
timestamp value
------------------------------------------
0 2015-02-21 03:42:35+00:00 45
1 2015-02-21 03:42:36+00:00 46
2 2015-02-21 03:42:37+00:00 49
3 2015-02-21 03:42:38+00:00 55
4 2015-02-21 03:42:39+00:00 59
5 2015-02-21 03:42:40+00:00 54
...
This dataframe was created after running:
df['timestamp'] = pd.to_datetime(df['timestamp'], utc=True)
What I want to do is take my seconds resolution timestamps, and then resample as milliseconds, and then fill in those new millisecond timestamps with interpolated (linear interpolation) values, so I will be left with a dataframe of now millisecond-resolution data. I tried the following code:
upsampled = df.resample('ms')
interpolated = upsampled.interpolate(method='linear')
interpolated.head()
And I receive the following error:
TypeError: Only valid with DatetimeIndex, TimedeltaIndex or PeriodIndex, but got an instance of 'RangeIndex'
from this line:
upsampled = df.resample('ms')
How can I resolve my dataframe issue so that the timestamps can be properly handled, resampled, and interpolated? Since it appears there is some sort of issue with how my timeseries data was read in. Also, if milliseconds is perhaps too high of a resolution to reasonably process, I would be fine with just fractions of seconds too, just something a bit higher-resolution than seconds.