0

I have the following Pandas Dataframe 'df':

           Rt_low  Rt_avg  Rt_up   year  month  day
Date                                                
2020-02-17    0.50    1.93   4.00   2020      2   17
2020-02-18    0.00    1.74   4.00   2020      2   18
2020-02-19    0.50    1.59   2.83   2020      2   19
2020-03-17    1.83    2.74   2.83   2020      3   17
2020-03-18    1.67    3.03   3.67   2020      3   18
2020-03-19    1.50    2.59   2.83   2020      3   19

How do I get the average value of "Rt_low" for month=02 and how do I get the average value for month=3. And then also, how do I get the average value for day = 17, for day= 18, day=19.

The total datafile consist of daily records for almost a full year. I want to have output like (exemplatory values), can be a list or Pandas dataframe:

Rt_low_avg_monthly = {"January": 1.20, "February": 2.40, "March": 1.80, ..., "December": NaN};
Rt_low_avg_daily = {01: 1.20, 02: 2.40, 03: 1.80, ..., 31: 2.40};
Jeroen
  • 801
  • 6
  • 20

0 Answers0