-
-
Save amankharwal/c92a3a722d994f714ccea674737e75cd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
most_books = df.groupby('authors')['title'].count().reset_index().sort_values('title', ascending=False).head(10).set_index('authors') | |
plt.figure(figsize=(15,10)) | |
ax = sns.barplot(most_books['title'], most_books.index, palette='inferno') | |
ax.set_title("Top 10 authors with most books") | |
ax.set_xlabel("Total number of books") | |
totals = [] | |
for i in ax.patches: | |
totals.append(i.get_width()) | |
total = sum(totals) | |
for i in ax.patches: | |
ax.text(i.get_width()+.2, i.get_y()+.2,str(round(i.get_width())), fontsize=15,color='black') | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment