Box plot of hourly data in Time Series Python

后端 未结 2 405
逝去的感伤
逝去的感伤 2021-01-27 08:06

How to group by a given frequency let say Hourly, and create a set of box plot for one column in a time series data set ?

range = pd.date_range(\'2015-01-01\',          


        
相关标签:
2条回答
  • 2021-01-27 08:39

    IIUC, you need, which gives you a box of speed during each hour of the a day:

    #You need to reshape your dataframe with hours as column headers
    df.set_index(df.index.hour, append=True)['speed'].unstack().plot.box()
    

    Output:

    0 讨论(0)
  • 2021-01-27 08:45

    You can also use seaborn:

    sns.boxplot(x=df.index.hour, y=df.speed)
    

    output:

    0 讨论(0)
提交回复
热议问题