category = df.category_name_column.value_counts()
I have the above series which returns the values:
CategoryA,100
CategoryB,200
I am trying to plot the top 5 category names in X - axis and values in y-axis
head = (category.head(5))
sns.barplot(x = head ,y=df.category_name_column.value_counts(), data=df)
It does not print the "names" of the categories in the X-axis, but the count. How to print the top 5 names in X and Values in Y?
x
andy
are implicit (deprecated) or explicit (supported), so the accepted answer is still fully supported as long as we specifyx
andy
explicitly:sns.barplot(x=head.index, y=head.values)
– Helgoland