Skip to content Skip to sidebar Skip to footer

Modify Ohlc Resample Code As Per Deprecated Warning

Issue: When working with market data and resampling intra-day data to the daily timeframe as follows: ohlc_dict = { 'Open':'first', 'High':'max', 'Low':'min', 'Last': 'last', 'Volu

Solution 1:

.resample() works like groupby so you can pass that dictionary to resample().agg():

df.resample('1D').agg(ohlc_dict).tail().dropna()
Out: 
              Volume    Last    High    Open     Low
Timestamp                                           
2016-12-27  144793.0  164.11  164.18  163.55  163.55
2016-12-28  215288.0  164.22  164.33  164.18  163.89
2016-12-29  245538.0  164.49  164.65  164.44  164.27
2016-12-30  286847.0  164.18  164.56  164.55  164.09

Post a Comment for "Modify Ohlc Resample Code As Per Deprecated Warning"