Merging daily and monthly timeseries data

Suppose I want to merge two Timeseries. One is daily and might have the first daily observation in the month on the 2nd or 3rd day, and might have a last observation on the 29th. I would hope to collapse the data to monthly and merge with a monthly series. But the collapsed data must have a day of the month equal to the first or last observed day, and hence would not merge nicely with monthly data that has a convention of day = 1 for all months. Is there a way to do this easily?

I don’t know if I understood all the requirements, but I am assuming you already tried merge from TimeSeries.jl: Combine methods Β· TimeSeries.jl

Thanks, yes. The problem with merge is that the monthlly data will have time stamps like: 2020–01-01, 2020-02-01, 2020-03-01… but the daily data, collapsed will look like 2020-01-03, 2020-02-01, 2020-03-01… That is, the daily data coillapsed will not always terminate with β€œ-01”.

I know it might feel redundant, but is it possible to just create another column with the dates you want to merge on? So the collapsed data would have two columns, one with the first date observed (2020-01-03) and another with the first day of the month (2020-01-01)?

Another option, that basically is the same as what I suggested but might be cleaner is to use MonthlyDates.jl, which would allow you to just use the month-year combination.

1 Like