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
| # ---------- 4th ITERATIONS - ADD DATA LABELS AND TITLES ---------- | |
| # Figure size | |
| fig = plt.figure(figsize = (10, 4.8)) | |
| # Bar plot | |
| bar_fig = plt.bar( | |
| x = 'PaymentMethod', | |
| height = 'customerID', | |
| data = df_group_1, |
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
| # ---------- 3rd ITERATION - REMOVE FRAMES AND RESET THE VERTICAL TICKS ---------- | |
| # Figure size | |
| fig = plt.figure(figsize = (10, 4.8)) | |
| # Bar plot | |
| bar_fig = plt.bar( | |
| x = 'PaymentMethod', | |
| height = 'customerID', | |
| data = df_group_1, |
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
| # ---------- 2nd ITERATION - REORDER THE CATEGORIES AND DO COLORING ---------- | |
| # Reorder the PaymentMethod based on total customer | |
| df_group_1.sort_values(by = 'customerID', ascending = False, inplace = True) | |
| # Figure size | |
| fig = plt.figure(figsize = (10, 4.8)) | |
| # Bar plot | |
| bar_fig = plt.bar( |
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
| # ---------- 1st ITERATION - CREATE A BASIC BAR PLOT ---------- | |
| # Figure size | |
| fig = plt.figure(figsize = (10, 4.8)) | |
| # Bar plot | |
| plt.bar( | |
| x = 'PaymentMethod', | |
| height = 'customerID', | |
| data = df_group_1, |
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
| # ---------- IMPORT PACKAGES ---------- | |
| # Dataframe manipulation | |
| import pandas as pd | |
| # Matrices operation | |
| import numpy as np | |
| # Data viz with matplotlib | |
| import matplotlib |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| # Flask | |
| from flask import Flask, render_template, request | |
| # Data manipulation | |
| import pandas as pd | |
| # Matrices manipulation | |
| import numpy as np | |
| # Script logging | |
| import logging | |
| # ML model | |
| import joblib |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
| # Machine learning model development | |
| # XGBoost model | |
| xgb_model = xgb.XGBClassifier( | |
| objective = 'binary:logistic', | |
| use_label_encoder = False | |
| ) | |
| # Define parameters range | |
| params = { |