|
| 1 | +import pandas as pd |
| 2 | +import numpy as np |
| 3 | + |
| 4 | +np.random.seed(42) |
| 5 | +n_train = 500 |
| 6 | + |
| 7 | +train_data = pd.DataFrame({ |
| 8 | + "age": np.random.randint(21, 65, size=n_train), |
| 9 | + "income": np.random.randint(20000, 120000, size=n_train), |
| 10 | + "loan_amount": np.random.randint(1000, 50000, size=n_train), |
| 11 | + "credit_score": np.random.randint(300, 850, size=n_train), |
| 12 | + "default": np.random.choice([0, 1], size=n_train, p=[0.8, 0.2]) |
| 13 | +}) |
| 14 | + |
| 15 | +train_data.to_csv("train_data.csv", index=False) |
| 16 | +print("Sample training file 'train_data.csv' created!") |
| 17 | + |
| 18 | +# Optional: sample prediction data |
| 19 | +n_pred = 10 |
| 20 | +predict_data = pd.DataFrame({ |
| 21 | + "age": np.random.randint(21, 65, size=n_pred), |
| 22 | + "income": np.random.randint(20000, 120000, size=n_pred), |
| 23 | + "loan_amount": np.random.randint(1000, 50000, size=n_pred), |
| 24 | + "credit_score": np.random.randint(300, 850, size=n_pred) |
| 25 | +}) |
| 26 | + |
| 27 | +predict_data.to_csv("new_applicants.csv", index=False) |
| 28 | +print("Sample prediction file 'new_applicants.csv' created!") |
0 commit comments