Hello!
I have a df that looks like this:
my goal is to make a line chart that sums up the codes for each month and, after this, add a dropdown to be able to filter between ‘type’, group’ and ‘Spec.’
If I didn’t want the dropdown filter, I could achieve this with
`df.groupby('month')['code'].count().reset_index()`
Since I need the filters, the ideal is to be able to do this sum in the graph code in plotly, so I don’t lose the ‘type’, group’ and ‘Spec.’ columns.
I tryed this code:
`line_fig1 = px.line(data_frame = df,
x= 'month',
y='code',
labels={'month':'','code':''},
title='',
width=450,
height=250,
template='plotly_white',
color_discrete_sequence= ["rgb(1, 27, 105)"],
markers=True,
text='code'
)`
and this was the result:
I also tryed something like
`line_fig1 = px.line(data_frame = df,
x= 'month',
y='code'.count()`
or even tryed to add a column with a number one, so the chart could aggregate
`df['assign_value'] = 1
line_fig1 = px.line(data_frame = df,
x= 'month',
y='assign_value'`
But this also don’t work. This is the graph for this last code.
and yes, the type of the assign_value is int
Any help here?