Pandas group by time with specified start time with non integer minutes

给你一囗甜甜゛ 提交于 2019-12-01 09:23:27

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
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!