2

I am going to get a maximum value from multiple columns and a rolling time index. How can I do it?

For example, I would like to get the maximum (and median) value from 3 days (+/- 1 day) and multiple columns

            1006    1037    1041    
1950-02-06  2.3     3.2     4.2     
1951-12-29  3.5     5.6     3.3     
1951-12-30  4.7     2.8     5.7    
1952-01-12  6.1     4.3     3.1     
1952-01-13  2.1     1.6     4.3   
1952-01-14  3.2     2.2     4.7  

Is it possible to get values like?

            Max  Med
1950-02-06  4.2  3.2   
1951-12-29  5.7  3.0
1951-12-30  5.7  3.0 
1952-01-12  6.1  3.7
1952-01-13  6.1  3.2
1952-01-14  4.7  2.7 

The maximum value of 1952-01-13 is calculated from 1952-01-12 ~ 1952-01-14

The maximum value of 1952-01-14 is calculated from 1952-01-13 and 1952-01-14

I also need to get the median values, so I cannot get the max from all columns first and then do rolling.

Thank you so much in advance

linyenheng
  • 33
  • 3

0 Answers0