Question:
When working with market data and re-sampling intraday data on daily timeframes as follows:
ohlc_dict = { 'Open':'first', 'High':'max', 'Low':'min', 'Last': 'last', 'Volume': 'sum'} data.resample('1D',how=ohlc_dict).tail().dropna() Open High Last Low Volume Timestamp 2016-12-27 163.55 164.18 164.11 163.55 144793.00 2016-12-28 164.18 164.33 164.22 163.89 215288.00 2016-12-29 164.44 164.65 164.49 164.27 245538.00 2016-12-30 164.55 164.56 164.18 164.09 286847.00
Which seems to give me the result I need (still need to check) ...
I get the following warning:
FutureWarning: how in .resample() is deprecated the new syntax is .resample(...)..apply(<func>)
Question:
How would this replicated resample code be created using the new syntax to align with current best practice using apply ?
What I tried:
Just using the data ['Low'] as an example:
def ohlc (df): return df['Low'].min() data.resample('1D').dropna().apply(ohlc,axis=1).tail(2) Timestamp 2016-12-29 164.45 2016-12-30 164.26 dtype: float64
It does not give me the same results, and I'm not sure where to apply .
Here is a piece of data to check this out if necessary:
thanks
python pandas
ade1e
source share