I'm trying to use the following code to convert daily OHLCV data to weekly:
#resample so that Open is the first monday price, High and low are the weeks min and max and close is the last sunday price and volume is the sum (can be customized - pandas docs)
logic = {'Open' : 'first',
'High' : 'max',
'Low' : 'min',
'Close' : 'last',
'Volume': 'sum'}
from pandas.tseries.frequencies import to_offset
BTC.resample('W').apply(logic)
BTC.index -= to_offset("6D")
BTC.head()
this prints a dataframe that is simply the original daily data with the date index offset by 6 days - with none of the logic applied. How can I successfully resample to weekly and apply the logic?