Aggregate plot by time of day after doing some grouping

Could have posted this to hvplot group but I think this is more a holoviews topic. To explain, let me show some exemplary code:

dr = pd.date_range("2020-01-01","2020-01-10",freq="min")
counts = np.random.normal(0,1,(len(dr)))
df = pd.DataFrame(index=dr, columns=["counts"])
df["counts"] = counts
df["time"] = df.index.time
df["weekday"] = df.index.dayofweek
df.loc["2020-01-02", "counts"] = df.loc["2020-01-02", "counts"] * 5

# hvplot
df.groupby(["weekday","time"])[["counts"]].mean().reset_index().hvplot(x="time", y="counts", groupby="weekday")

# matplotlib
df.groupby(["weekday","time"])[["counts"]].mean().unstack("weekday").plot()

Matplotlib works perfect, I think bokeh can’t handle the x-axis because time is a str after index.dt.time. I can’t find another way to do this plot in Holoviews.

Could you file this as an issue in HoloViews?

1 Like