Search code examples
pandastime-seriesresampling

Merging time series data of different frequencies


I have 5 min intraday stock price data which I downsample by the following code:

ohlc = {                                                                                                             
'Open':'first',                                                                                              
'High':'max',                                                                                                     
'Low':'min',                                                                                                        
'Close': 'last',                                                                                                    
'Volume': 'sum'
}

d1_data = min5_data.resample('1d').apply(ohlc).dropna()

what I am trying to achieve is to merge the 5 min intraday and day data and match it by date (basically same values on 5 min interval for the whole duration of the trading day or 78 values in total). My idea is to have a reference for the opening price and day range expressed by High and Low.

It is not necessary to go thru resampling if there is another way.

Thank you


Solution

  • I found it!

    merged_data = pd.concat([min5_data, d1_data], axis=1).ffill()
    

    Thanks for the answer anyway