Reputation:
I am new to Seaborn, and I am trying to plot a barplot
that shows the average (mean) of an attribute on the Y axis, but I am unsure what is going wrong with my code.
This is my code:
fig, ax = plt.subplots(figsize=(15,10))
sns.barplot(data=df, x='Day', y=df['Spending'].mean())
ax.set(xlabel="Day of the Week", ylabel = "Average Spending each Day")
When I try to execute my code, I just get this error:
AttributeError: 'bool' object has no attribute 'all'
Any help on how to get the average to show on my Y axis would be greatly appreciated, including what I am doing wrong.
Thank you!
Upvotes: 0
Views: 1023
Reputation: 150805
By default,
sns.barplot(data=df, x='Day', y='Spending')
shows the mean of Spending
on the y
axis.
Upvotes: 1