Created
June 2, 2022 18:07
-
-
Save kusal1990/db711a99dc3f8ec1d64d165431f0e5cb to your computer and use it in GitHub Desktop.
This file contains hidden or 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
subplot = sns.countplot(x='target', data=df_metadata_train) | |
# https://github.com/mwaskom/seaborn/issues/1582 | |
for i,j in enumerate(subplot.patches): | |
percent = np.round((df_metadata_train[df_metadata_train['target']==i].shape[0]/df_metadata_train['target'].shape[0])*100, 2) | |
subplot.annotate(str(df_metadata_train[df_metadata_train['target']==i].shape[0]) + f" ({percent}%)", | |
(j.get_x()+j.get_width()/2, j.get_height())) | |
plt.title("Distribution of target classes") | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
ok