具有多重索引的时间序列图Seaborn

问题描述 投票:0回答:1

我有以下数据集:

                     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 
...

数据集跨越三个月,每天计算五个代码的出现次数。

为了绘制数据,我刚刚使用了以下代码:

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

但是,我想知道如何使用seaborn和lineplot完成此操作?

python time-series seaborn line-plot
1个回答
0
投票

这是您要寻找的吗?

sns.lineplot(x='Submit date', y='Count', style='Code', data=groupeddataset.reset_index())
© www.soinside.com 2019 - 2024. All rights reserved.