[英]How do I plot a Seaborn FacetGrid with the result of the `groupby`?
I have the following pandas
Dataframe
:我有以下
pandas
Dataframe
:
A B C
0 2017-01-01 1 4.199197e+06
1 2017-01-01 2 8.708300e+06
2 2017-01-01 3 5.401463e+06
the result of a groupby operation: groupby 操作的结果:
tot_reg = (sales.groupby(['A', 'B'])[['C']]
.sum()
.reset_index())
I would like an Seaborn
sns.Facetgrid
plotting A
on the x-axis, C
on the y-axis, for every B there is, I have:我想要一个
Seaborn
sns.Facetgrid
在 x 轴上绘制A
,在 y 轴上绘制C
,对于每个 B,我有:
sns.FacetGrid(tot_reg, col='B', col_wrap=4)
but although it does count the unique B
and draws the correct number of subplots, the plots are empty.但是尽管它确实计算了唯一的
B
并绘制了正确数量的子图,但这些图是空的。
How do I plot a Seaborn FacetGrid with the result of the groupby
?如何使用
groupby
的结果绘制 Seaborn FacetGrid ?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.