Getting the average of a certain hour on weekdays over several years in a pandas dataframe

前端 未结 2 530

I have an hourly dataframe in the following format over several years:

Date/Time            Value
01.03.2010 00:00:00  60
01.03.2010 01:00:00  50
01.03.2010          


        
2条回答
  •  长情又很酷
    2020-12-05 12:11

    If your date/time column were in the datetime format (see dateutil.parser for automatic parsing options), you can use pandas resample as below:

    year_hour_means = df.resample('H',how = 'mean')
    

    which will keep your data in the datetime format. This may help you with whatever you are going to be doing with your data down the line.

提交回复
热议问题