Created
May 16, 2022 11:59
-
-
Save audhiaprilliant/c2e0583e98e3b8feac4a61e0dfe7342d to your computer and use it in GitHub Desktop.
End to end machine learning model deployment using flask
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
| # 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