-
-
Save amandaiglesiasmoreno/2da32c05fe0a99cc1257abb09a2e2c94 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
# create a figure | |
fig = plt.figure(figsize=(10, 6)) | |
ax = fig.add_subplot(111) | |
# proportion of observation of each class | |
prop_response = df_telco['Churn'].value_counts(normalize=True) | |
# create a bar plot showing the percentage of churn | |
prop_response.plot(kind='bar', | |
ax=ax, | |
color=['springgreen','salmon']) | |
# set title and labels | |
ax.set_title('Proportion of observations of the response variable', | |
fontsize=18, loc='left') | |
ax.set_xlabel('churn', | |
fontsize=14) | |
ax.set_ylabel('proportion of observations', | |
fontsize=14) | |
ax.tick_params(rotation='auto') | |
# eliminate the frame from the plot | |
spine_names = ('top', 'right', 'bottom', 'left') | |
for spine_name in spine_names: | |
ax.spines[spine_name].set_visible(False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment