Issue
When I plot a seaborn barplot using a median estimator, i get the below error. Seems to work for other estimators (e.g. sum). What am I missing?
j = sns.barplot(x='category', y='sales', data=perf, estimator=median)
for item in j.get_xticklabels():
item.set_rotation(90)
plt.show()
NameError: name 'median' is not defined
Solution
Import it:
from numpy import median
Or
import numpy as np
j = sns.barplot(x='category', y='sales', data=perf, estimator=np.median)
Answered By - Kartik
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.