✊🏿 Black Lives Matter. Please consider donating to Black Girls Code today.
⚾️ It's finally Baseball season! Root for the home team... & Register for our Sports Analytics Webinar!

Showing all data points instead of Aggregate

Hi Team,

The below line plot seems to display all experiments instead of the aggregate.

I was expecting something like this


I can’t see what your employment dataset looks like but I would check and make sure that the dataframe your passing in (employment) is in itself a groupby dataframe. The correct dataframe to pass in would only have 1 row per age group per period.

In short:

df = employment.groupby(["Period","Age"],as_index=False).sum()
fig = px.line(employment, x="Period", y="Unemployment", color= "Age")

or straight up do the groupby while you create the plot.

fig = px.line(employment.groupby(['Period','Age'],as_index=False).sum() , x="Period", y="Unemployment", color= "Age")