Reputation: 2511
I have this:
date emaslow
105857 2017-10-24 22:50:00 0.000037
105858 2017-10-24 22:55:00 0.000037
105859 2017-10-24 23:00:00 0.000037
It is a huge data set, this is only the tail(3)
bit and the date
and emaslow
columns. I am trying to resample this a little bit so I get a smoother plot. But no matter what I do, I get the nasty:
TypeError: Only valid with DatetimeIndex, TimedeltaIndex or PeriodIndex, but
got an instance of 'RangeIndex'
I tried to set
and reset
the index with df.reset_index()
and df.set_index('date')
But with no luck.
I am trying to get a smoother, version of the red plot. The blue one is wrong and it is just a place holder.
Upvotes: 1
Views: 1835
Reputation: 323226
Are you looking for resample
, you can change the sum
to mean
or whatever you need.
df.set_index('date').resample('10T').sum()
Out[502]:
emaslow
date
2017-10-24 22:50:00 0.000074
2017-10-24 23:00:00 0.000037
Upvotes: 1