xKDR / TSFrames.jl

Timeseries in Julia
MIT License
89 stars 22 forks source link

Method for aggregation #164

Open ValentinKaisermayer opened 1 year ago

ValentinKaisermayer commented 1 year ago

The method should accept a Dates.Period and apply a function to each of those periods in the TSFrame. Like computing the daily mean of hourly data. Control over the time index that is used in the output would also be nice. Like should the first be used or the last in the period.

ValentinKaisermayer commented 1 year ago

Computing the daily mean from hourly data is easy, since it is simply 24 vales each, but the monthly or yearly mean would be harder, since not every period might be of the same length.

smishr commented 9 months ago

@chiraganand @codetalker7 Your thoughts on this feature?

ValentinKaisermayer commented 9 months ago

One easy way is to simply apply the given method, i.e. month to the timestamps and then compute the intervals for the aggregation when this changes. idx = findall(diff(month.(timestamps))). Or in a for-loop.

chiraganand commented 3 months ago

Doesn't apply() handle this use case?