Skip to content

Instantly share code, notes, and snippets.

@VincentTatan
Last active May 3, 2020 03:23
Show Gist options
  • Save VincentTatan/5402c0e09193846440ea2e33a66c1774 to your computer and use it in GitHub Desktop.
Save VincentTatan/5402c0e09193846440ea2e33a66c1774 to your computer and use it in GitHub Desktop.
def create_pie(df,target_variable,figsize=(10,10)):
print(df[target_variable].value_counts())
fig, ax = plt.subplots(figsize=figsize)
ax.pie(df[target_variable].value_counts().values, labels=df[target_variable].value_counts().index,autopct = '%1.2f%%',textprops={'fontsize': 20})
ax.axis('equal')
plt.title(target_variable)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment