December 2018
Beginner to intermediate
330 pages
8h 32m
English
For this example, we will go back to our credit card default example. As always, let's run all the code we need to get our dataset ready:
import numpy as npimport pandas as pdimport matplotlib.pyplot as pltimport seaborn as snsimport os%matplotlib inline
This is how we prepare the dataset:
# Loading the datasetDATA_DIR = '../data'FILE_NAME = 'credit_card_default.csv'data_path = os.path.join(DATA_DIR, FILE_NAME)ccd = pd.read_csv(data_path, index_col="ID")ccd.rename(columns=lambda x: x.lower(), inplace=True)ccd.rename(columns={'default payment next month':'default'}, inplace=True)# getting the groups of featuresbill_amt_features = ['bill_amt'+ str(i) for i in range(1,7)]pay_amt_features = ['pay_amt'+ str(i) ...