开发者

How to reference to other periods or columns when using aggregate()

开发者 https://www.devze.com 2023-01-17 18:59 出处:网络
When using aggregate, how can I make reference to a previous period within the function? For example if aggregating by days how can make reference to the previous day from the next day in order to ca

When using aggregate, how can I make reference to a previous period within the function? For example if aggregating by days how can make reference to the previous day from the next day in order to calculate the function.

For example if I had a one year hourly time series and I like to calculate the maximum of one day minus the minimum of the previous day I could use two different aggregates, shifting one of them and substracting from the other, but how could I do it all from within just one aggregate?

How can I know the number of the piece (here the day) w开发者_开发问答here am I in order to use it inside the function?

cheers


As long as you have it appropriately sorted, you can use the shift() function I provided in response to a (much more specific) question.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号