I got a dataframe that has some columns, i need to use that data to plot a plotly line chart graph.
ORIGEN | TIMESTAMP DATE |
---|---|
ORANGE | 2023-02-03 00:00:00 |
ORANGE | 2023-02-03 00:00:00 |
ORANGE | 2023-02-10 00:00:00 |
APPLE | 2023-02-24 00:00:00 |
APPLE | 2023-04-18 00:00:00 |
APPLE | 2023-04-18 00:00:00 |
I need to transform it to this form.
ORIGEN | TIMESTAMP DATE | COUNT |
---|---|---|
ORANGE | 2023-02-03 00:00:00 | 2 |
ORANGE | 2023-02-10 00:00:00 | 1 |
APPLE | 2023-02-24 00:00:00 | 1 |
APPLE | 2023-04-18 00:00:00 | 2 |
I tried using PD.MELT and groupby but it didn't work. I'm trying to replicate something like this: