Just looking for some help to resample my 1min OHLCV data to 5min. I have used this answer to guide me, however I seem to be coming up with an error stating: {Key error Timestamps}
import pandas as pd
df= pd.read_csv("/Users/dstan1/Downloads/fut01.csv",
names=['timestamps','open','high','low','close','volume'])
df.set_index('timestamps',inplace=True)
ohlc_dict = {
'open':'first',
'high':'max',
'low':'min',
'close':'last',
'volume':'sum'
}
df['timestamps'] = pd.to_datetime(df['timestamps'])
df.set_index('timestamps', inplace=True)
df.resample('5T', how=ohlc_dict)
print (df)
Wanting to turn it into (used from the referenced example).
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
Any help or guidance would be greatly appreciated.