<jupyter_start><jupyter_text><jupyter_code><jupyter_output><empty_output><jupyter_text>Predicting Loan Status using Monte Carlo Simulation <NAME> MST 688 30 March 2021forecast the outcome of a portfolio of loans estimate what fraction of these loans will have charged off by the time all of their 3-year terms are finished<jupyter_code># Import required libraries

import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import csv

 # Import loan_timing.csv data set
from google.colab import files
uploaded = files.upload()
import io
df = pd.read_csv(io.BytesIO(uploaded['loan_timing.csv']))
df.head()
print(df)

# number of simulations
num_simulations = 1000

# number of days in 3-year loan
loan_duration = 1095

# number of loans
loan_quantity = 50000


def random_simulation(n):
  "return values after 'n' random simulations"
  x = 0
  y = 0
  for i in range(n):
    result = random.choice(NaN, values)
for i in range(num_simulations):
  default =<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.07522567703109329, 'fraction_numerical': 0.026078234704112337, 'mean_word_length': 5.198757763975156, 'pattern_counts': {'":': 0, '<': 10, '<?xml version=': 0, '>': 10, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '2', 'dir': 'jupyter-structured-clean-dedup', 'id': '640663', 'license': 'MIT', 'n_tokens_mistral': 348, 'n_tokens_neox': 316, 'n_words': 116, 'path': 'MST688_Monte_Carlo_Bakker.ipynb', 'repo_name': 'jdbakker42/ml_training', 'size': '1003'}