<jupyter_start><jupyter_text><jupyter_code>!pip install kaggle
from google.colab import files
files.upload()
!mkdir -p ~/.kaggle
!cp kaggle.json ~/.kaggle/

!chmod 600 ~/.kaggle/kaggle.json
!pip uninstall -y kaggle
!pip install —upgrade pip
!pip install kaggle==1.5.6
!kaggle -v
!kaggle competitions download -c home-credit-default-risk
from zipfile import ZipFile

file_name = "home-credit-default-risk.zip"

with ZipFile(file_name,"r") as zip:
  zip.extractall()
  print('done')
import numpy as np 
import pandas as pd
train = pd.read_csv('application_train.csv')
bureau = pd.read_csv('bureau.csv')
bureau_balance = pd.read_csv('bureau_balance.csv')
credit_card_balance = pd.read_csv('credit_card_balance.csv')
installments_payments = pd.read_csv('installments_payments.csv')
previous_application = pd.read_csv('previous_application.csv')
POS_CASH_balance = pd.read_csv('POS_CASH_balance.csv')

test = pd.read_csv('application_test.csv')
sample_sub = pd.read_csv('sample_submission.csv')
train.head(10)
x = [train,test]
Train_test =  pd.concat(x)

Train_test.sort_values(by = 'SK_ID_CURR' , ascending = True, inplace = True)
print(train.shape)
print(test.shape)
print(Train_test.shape)
Train_test.head(10)
bureau_merge = pd.merge(left=bureau,
                      right=bureau_balance,
                      how="left",
                      left_on="SK_ID_BUREAU",
                      right_index=True)
print(bureau.shape)
print(bureau_balance.shape)
print(bureau_merge.shape)
bureau_merge.duplicated(['SK_ID_CURR']).sum()
bureau_merge.head(10)
bureau_credit_merge = pd.merge(left=credit_card_balance,
                      right=bureau_merge,
                      how="left",
                      left_on="SK_ID_CURR",
                      right_index=True)
print(bureau_merge.shape)
print(credit_card_balance.shape)
print(bureau_credit_merge.shape)
bureau_credit_merge.head(10)
bureau_c_installment_merge = pd.merge(left=installments_payments,
                      right=bureau_credit_merge,
                      how="left",
                      left_on="SK_ID_CURR",
                      right_index=True)
print(installments_payments.shape)
print(bureau_credit_merge.shape)
print(bureau_c_installment_merge.shape)
bureau_c_installment_merge.head(10)
bureau_c_in_previous_merge = pd.merge(left=previous_application,
                      right=bureau_c_installment_merge,
                      how="left",
                      left_on="SK_ID_CURR",
                      right_index=True)
print(previous_application.shape)
print(bureau_c_installment_merge.shape)
print(bureau_c_in_previous_merge.shape)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10838368580060423, 'fraction_numerical': 0.006042296072507553, 'mean_word_length': 3.543739279588336, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '431325', 'license': 'MIT', 'n_tokens_mistral': 944, 'n_tokens_neox': 890, 'n_words': 128, 'path': 'CW/Home_Credit_default_risk_CW.ipynb', 'repo_name': 'Shaheer-Khan/AISem3', 'size': '2648'}