Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Select an option

  • Save audhiaprilliant/c2e0583e98e3b8feac4a61e0dfe7342d to your computer and use it in GitHub Desktop.

Select an option

Save audhiaprilliant/c2e0583e98e3b8feac4a61e0dfe7342d to your computer and use it in GitHub Desktop.
End to end machine learning model deployment using flask
# Number of customers by loan status
# Data aggregation between default and not default customers
df_viz_1 = df_train.groupby(['Loan_Status'])['Loan_ID'].count().reset_index(name = 'Total')
# Map the loan status
df_viz_1['Loan_Status'] = df_viz_1['Loan_Status'].map(
{
0: 'Not default',
1: 'Default'
}
)
# Figure size
plt.figure(figsize = (6.4,4.8))
# Customize colors and other settings
colors = ['#80797c','#981220']
# Explode 1st slice
explode = (0.1, 0)
# Create a pie chart
plt.pie(
x = 'Total',
labels = 'Loan_Status',
data = df_viz_1,
explode = explode,
colors = colors,
autopct = '%1.1f%%',
shadow = False,
startangle = 140
)
# Title and axis
plt.title('Number of customers by loan status', fontsize = 18)
plt.axis('equal')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment