I'm trying to add legend to my seaborn
bar plot. I already tried to add hue but it pops out error saying IndexingError: Unalignable boolean Series provided as indexer (index of the boolean Series and of the indexed object do not match).
so I tried other solution by giving it labels parameter. Here's the code
plt.figure(figsize=[15,12])
sns.barplot(x=customer['gender'].unique(),y=customer.groupby(['gender'])['gender'].count(),
data=customer,label=customer['gender'].unique())
plt.legend(loc="upper left")
This is the result, this result is wrong. It's supposed to have label Female and Male according to their color in the bar. The Female and Male is supposed to be separated with different colors. I already tried to follow this,this, and this but none of those work for me. How should I do it?