Skip to content Skip to sidebar Skip to footer

Box Plot Of Hourly Data In Time Series Python

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', '2015-12-31', freq='1

Solution 1:

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:

enter image description here

Solution 2:

You can also use seaborn:

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

output:

enter image description here

Post a Comment for "Box Plot Of Hourly Data In Time Series Python"