[英]With seaborn.facetgrid, how do I specify the color of a mapped scatter plot to reflect the values of a column in the data frame?
[英]How do I plot a Seaborn FacetGrid with the result of the `groupby`?
我有以下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
groupby 操作的結果:
tot_reg = (sales.groupby(['A', 'B'])[['C']]
.sum()
.reset_index())
我想要一個Seaborn
sns.Facetgrid
在 x 軸上繪制A
,在 y 軸上繪制C
,對於每個 B,我有:
sns.FacetGrid(tot_reg, col='B', col_wrap=4)
但是盡管它確實計算了唯一的B
並繪制了正確數量的子圖,但這些圖是空的。
如何使用groupby
的結果繪制 Seaborn FacetGrid ?
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.