pandas resampling time series code example
Example: resample 5 minutes on date
df['timestamps'] = pd.to_datetime(df['timestamps'])
df.set_index('timestamps', inplace=True)
>>> df.resample('5T', how=ohlc_dict)
high close open low volume
timestamps
2016-08-09 12:35:00 536.7849 536.7849 536.7841 536.6141 0.656000
2016-08-09 12:40:00 536.6749 534.8416 536.6749 534.1801 2.277200
2016-08-09 12:45:00 538.5999 537.7289 534.8131 534.2303 2.971872
2016-08-09 12:50:00 539.2199 539.2199 537.9829 537.9829 1.115219