我是seaborn情节的初学者。作为样本,seaborn提供了平均"天"的条形图。但是,是否可以提供一个条形图,其中包含天数值的总和(总和),计数,......
import seaborn as sns
sns.set_style("whitegrid")
tips = sns.load_dataset("tips")
ax = sns.barplot(x = "day",y = "total_bill",data=tips)
答案 0 :(得分:5)
来自docstring:
Parameters: ----------- [...] estimator : callable that maps vector -> scalar, optional Statistical function to estimate within each categorical bin.
所以
ax = sns.barplot(x="day", y="total_bill", data=tips, estimator=sum)
答案 1 :(得分:0)
这个问题很久以前就被问到了,但作为一个初学者,我来到这里,可以找到计算哪种作品的解决方案
from numpy import count_nonzero
ax = sns.barplot(x="day", y="total_bill", data=tips, estimator= count_nonzero)
可能在提出问题很久之后才引入了 count_nonzero