This tutorial shows an example of generating multiple curves from a single DataFrame, using a column to group them. I am using hv.DynamicMap
to work with streaming data (per this tutorial) and I would like to generate multiple curves using a similar grouping mechanism.
My current invocation looks like this:
def random_datapoint(**kwargs):
return pd.DataFrame({'returns': np.random.random(1), 'category': np.random.choice(4)}, index=[pd.Timestamp.now()])
sdf = streamz.dataframe.PeriodicDataFrame(random_datapoint, interval='300ms')
raw_dmap = hv.DynamicMap(hv.Curve, streams=[Buffer(sdf)], groupby='category')
(raw_dmap).opts(
opts.Curve(width=500, show_grid=True))
but it produces only one curve, not one for each distinct category in the ‘category’ column of the DataFrame. Thanks for your help.