<jupyter_start><jupyter_text>Data Preparation  Import Libraries<jupyter_code>import numpy as np
import pandas as pd<jupyter_output><empty_output><jupyter_text>Import DataThe dataset contains all available data for more than 800,000 consumer loans issued from 2007 to 2015 by Lending Club: a large US peer-to-peer lending company. There are several different versions of this dataset. We have used a version available on kaggle.com. You can find it here: https://www.kaggle.com/wendykan/lending-club-loan-data/version/1We divided the data into two periods because we assume that some data are available at the moment when we need to build Expected Loss models, and some data comes from applications after. Later, we investigate whether the applications we have after we built the Probability of Default (PD) model have similar characteristics with the applications we used to build the PD model.<jupyter_code>loan_data_backup = pd.read_csv('loan_data_2007_2014.csv')
loan_data = loan_data_backup.copy()<jupyter_output><empty_output><jupyter_text>Explore Data<jupyter_code>loan_data
pd.options.display.max_columns = None
#pd.options.display.max_rows = None
# Sets the pandas dataframe options to display all columns/ rows.
loan_data
loan_data.head()
loan_data.tail()
loan_data.columns.values
# Displays all column names.
loan_data.info()
# Displays column names, complete (non-missing) cases per column, and datatype per column.<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.06593406593406594, 'fraction_numerical': 0.015796703296703296, 'mean_word_length': 6.072815533980583, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 13, 'https://': 1, 'lorem ipsum': 0, 'www.': 1, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '3', 'dir': 'jupyter-structured-clean-dedup', 'id': '497002', 'license': 'Apache-2.0', 'n_tokens_mistral': 448, 'n_tokens_neox': 409, 'n_words': 160, 'path': 'Credit Risk Modeling/Credit Risk Modeling - Preparation - With Comments - 4-1.ipynb', 'repo_name': 'autodidact-m/Projects', 'size': '1456'}