Pandas Group By Time With Specified Start Time With Non Integer Minutes
I have a dataframe with one hour long signals. I want to group them in 10 minutes buckets. The problem is that the starting time is not precisely a 'multiple' of 10 minutes, theref
Solution 1:
base
accepts a float argument. In addition to the minutes, you must also consider the seconds.
base = ts.index[0].minute + ts.index[0].second/60
ts.groupby(pd.Grouper(freq=interval, base=base)).size()
2011-01-01 00:05:30 600
2011-01-01 00:15:30 600
2011-01-01 00:25:30 600
2011-01-01 00:35:30 600
2011-01-01 00:45:30 600
2011-01-01 00:55:30 600
Freq: 10T, dtype: int64
Post a Comment for "Pandas Group By Time With Specified Start Time With Non Integer Minutes"