0

I have the following dataset:

                     Count
Submit date   Code
2019-09-01    1      24 
2019-09-01    2      29
2019-09-01    3      11
2019-09-01    4      55 
2019-09-01    5      NaN
2019-09-02    1      9
2019-09-02    2      19
2019-09-02    3      NaN
2019-09-02    4      71 
2019-09-02    5      8 
2019-09-03    1      5 
...

The dataset spans three months and counts the occurrence of five codes per day.

In order to plot the data I have just used the following code:

groupeddataset['Count'].unstack().fillna(0).plot(figsize=(60,20),lw = 3, marker = "o", ms = 3)

I am wondering though, how this can be done using seaborn and a lineplot ?

Miszka_R
  • 119
  • 1
  • 11

1 Answers1

1

Is this what you are looking for?

sns.lineplot(x='Submit date', y='Count', style='Code', data=groupeddataset.reset_index())
Diziet Asahi
  • 38,379
  • 7
  • 60
  • 75
  • This works. In order to fill out NAs, I have added `data=groupeddataset.fillna(0).reset_index()`. Thank you ! – Miszka_R Dec 15 '19 at 11:48