|
13 | 13 | "source": [ |
14 | 14 | "Based on the conclusion of the Exploratory Data Analysis, we fill in some missing data assuming the following hypothesis:\n", |
15 | 15 | "\n", |
16 | | - "- If a client has no information about the Credit_History and had their application rejected, they do not meet the bank guidelines (Credit_History = 0).\n", |
17 | | - "- Fill in the Self_employed with 'Employed', which is the most common case.\n", |
| 16 | + "- Fill in the Credit_History with 1. \n", |
18 | 17 | "- Fill in the LoanAmount_Terms with 360 for clients who have this value missing.\n", |
19 | 18 | "- Fill in the CoapplicantIncome with 0." |
20 | 19 | ] |
21 | 20 | }, |
22 | 21 | { |
23 | 22 | "cell_type": "code", |
24 | | - "execution_count": 127, |
| 23 | + "execution_count": 2, |
25 | 24 | "metadata": {}, |
26 | 25 | "outputs": [], |
27 | 26 | "source": [ |
|
41 | 40 | }, |
42 | 41 | { |
43 | 42 | "cell_type": "code", |
44 | | - "execution_count": 128, |
| 43 | + "execution_count": 3, |
45 | 44 | "metadata": {}, |
46 | 45 | "outputs": [ |
47 | 46 | { |
|
50 | 49 | "(614, 14)" |
51 | 50 | ] |
52 | 51 | }, |
53 | | - "execution_count": 128, |
| 52 | + "execution_count": 3, |
54 | 53 | "metadata": {}, |
55 | 54 | "output_type": "execute_result" |
56 | 55 | } |
|
70 | 69 | }, |
71 | 70 | { |
72 | 71 | "cell_type": "code", |
73 | | - "execution_count": 129, |
| 72 | + "execution_count": 4, |
74 | 73 | "metadata": {}, |
75 | 74 | "outputs": [], |
76 | 75 | "source": [ |
77 | 76 | "df_fill = df_import.copy()\n", |
78 | | - "# df_fill.loc[df_fill['Credit_History'].isnull(),'Credit_History'] = 1\n", |
79 | | - "df_fill.loc[(df_fill['Loan_Status'] == 'N') & (df_fill['Credit_History'].isnull()),'Credit_History'] = 0\n", |
| 77 | + "df_fill.loc[df_fill['Credit_History'].isnull(),'Credit_History'] = 1\n", |
80 | 78 | "df_fill.loc[df_fill['Loan_Amount_Term'].isnull(),'Loan_Amount_Term'] = 360\n", |
81 | | - "df_fill.loc[df_fill['Self_Employed'].isnull(),'Self_Employed'] = 'No'\n", |
| 79 | + "# df_fill.loc[df_fill['Self_Employed'].isnull(),'Self_Employed'] = 'No'\n", |
82 | 80 | "df_fill.loc[df_fill['CoapplicantIncome'].isnull(),'CoapplicantIncome'] = 0" |
83 | 81 | ] |
84 | 82 | }, |
|
91 | 89 | }, |
92 | 90 | { |
93 | 91 | "cell_type": "code", |
94 | | - "execution_count": 130, |
| 92 | + "execution_count": 5, |
95 | 93 | "metadata": {}, |
96 | 94 | "outputs": [], |
97 | 95 | "source": [ |
|
113 | 111 | }, |
114 | 112 | { |
115 | 113 | "cell_type": "code", |
116 | | - "execution_count": 131, |
| 114 | + "execution_count": 7, |
117 | 115 | "metadata": {}, |
118 | 116 | "outputs": [ |
119 | 117 | { |
120 | 118 | "data": { |
121 | 119 | "text/plain": [ |
122 | | - "Gender 530\n", |
123 | | - "Married 530\n", |
124 | | - "Dependents 530\n", |
125 | | - "Education 530\n", |
126 | | - "Self_Employed 530\n", |
127 | | - "ApplicantIncome 530\n", |
128 | | - "CoapplicantIncome 530\n", |
129 | | - "LoanAmount 530\n", |
130 | | - "Loan_Amount_Term 530\n", |
131 | | - "Credit_History 530\n", |
132 | | - "Property_Area 530\n", |
133 | | - "Loan_Status 530\n", |
134 | | - "Base_Loan_Installment 530\n", |
135 | | - "Remaining_Income 530\n", |
| 120 | + "Gender 535\n", |
| 121 | + "Married 535\n", |
| 122 | + "Dependents 535\n", |
| 123 | + "Education 535\n", |
| 124 | + "Self_Employed 535\n", |
| 125 | + "ApplicantIncome 535\n", |
| 126 | + "CoapplicantIncome 535\n", |
| 127 | + "LoanAmount 535\n", |
| 128 | + "Loan_Amount_Term 535\n", |
| 129 | + "Credit_History 535\n", |
| 130 | + "Property_Area 535\n", |
| 131 | + "Loan_Status 535\n", |
| 132 | + "Base_Loan_Installment 535\n", |
| 133 | + "Remaining_Income 535\n", |
136 | 134 | "dtype: int64" |
137 | 135 | ] |
138 | 136 | }, |
139 | | - "execution_count": 131, |
| 137 | + "execution_count": 7, |
140 | 138 | "metadata": {}, |
141 | 139 | "output_type": "execute_result" |
142 | 140 | } |
|
155 | 153 | }, |
156 | 154 | { |
157 | 155 | "cell_type": "code", |
158 | | - "execution_count": 132, |
| 156 | + "execution_count": 8, |
159 | 157 | "metadata": {}, |
160 | 158 | "outputs": [], |
161 | 159 | "source": [ |
|
172 | 170 | }, |
173 | 171 | { |
174 | 172 | "cell_type": "code", |
175 | | - "execution_count": 133, |
| 173 | + "execution_count": 9, |
176 | 174 | "metadata": {}, |
177 | 175 | "outputs": [ |
178 | 176 | { |
|
204 | 202 | }, |
205 | 203 | { |
206 | 204 | "cell_type": "code", |
207 | | - "execution_count": 134, |
| 205 | + "execution_count": 10, |
208 | 206 | "metadata": {}, |
209 | 207 | "outputs": [], |
210 | 208 | "source": [ |
|
213 | 211 | }, |
214 | 212 | { |
215 | 213 | "cell_type": "code", |
216 | | - "execution_count": 135, |
| 214 | + "execution_count": 11, |
217 | 215 | "metadata": {}, |
218 | 216 | "outputs": [ |
219 | 217 | { |
|
466 | 464 | "9 2.0 1.0 194.444444 0.950142 " |
467 | 465 | ] |
468 | 466 | }, |
469 | | - "execution_count": 135, |
| 467 | + "execution_count": 11, |
470 | 468 | "metadata": {}, |
471 | 469 | "output_type": "execute_result" |
472 | 470 | } |
|
0 commit comments