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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
{
|
2 |
+
"nbformat": 4,
|
3 |
+
"nbformat_minor": 0,
|
4 |
+
"metadata": {
|
5 |
+
"colab": {
|
6 |
+
"provenance": [],
|
7 |
+
"mount_file_id": "17NySOZHXz-Z8fGG-i6zpH1BGn8MGsPF_",
|
8 |
+
"authorship_tag": "ABX9TyNj0zZ+MNSd0XgS6OnnIvik",
|
9 |
+
"include_colab_link": true
|
10 |
+
},
|
11 |
+
"kernelspec": {
|
12 |
+
"name": "python3",
|
13 |
+
"display_name": "Python 3"
|
14 |
+
},
|
15 |
+
"language_info": {
|
16 |
+
"name": "python"
|
17 |
+
}
|
18 |
+
},
|
19 |
+
"cells": [
|
20 |
+
{
|
21 |
+
"cell_type": "markdown",
|
22 |
+
"metadata": {
|
23 |
+
"id": "view-in-github",
|
24 |
+
"colab_type": "text"
|
25 |
+
},
|
26 |
+
"source": [
|
27 |
+
"<a href=\"https://colab.research.google.com/github/pravincoder/Tensorflow_models/blob/main/Loan_Approval_Prediction_Model.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
|
28 |
+
]
|
29 |
+
},
|
30 |
+
{
|
31 |
+
"cell_type": "markdown",
|
32 |
+
"source": [
|
33 |
+
"# Loan Approval Prediction Model\n",
|
34 |
+
"This is the link of the dataset :- [gdrive](https://drive.google.com/file/d/1LIvIdqdHDFEGnfzIgEh4L6GFirzsE3US/view?usp=sharing)\n",
|
35 |
+
"\n",
|
36 |
+
"\n",
|
37 |
+
"\n",
|
38 |
+
"_Source GeeksforGeeks_ "
|
39 |
+
],
|
40 |
+
"metadata": {
|
41 |
+
"id": "Aixd9CsjS4-Z"
|
42 |
+
}
|
43 |
+
},
|
44 |
+
{
|
45 |
+
"cell_type": "markdown",
|
46 |
+
"source": [
|
47 |
+
"## Importing the Modules & load the data\n"
|
48 |
+
],
|
49 |
+
"metadata": {
|
50 |
+
"id": "3u3IKHW6jYA5"
|
51 |
+
}
|
52 |
+
},
|
53 |
+
{
|
54 |
+
"cell_type": "code",
|
55 |
+
"execution_count": 3,
|
56 |
+
"metadata": {
|
57 |
+
"id": "IJNJ5pJBYlTd"
|
58 |
+
},
|
59 |
+
"outputs": [],
|
60 |
+
"source": [
|
61 |
+
"# Imports\n",
|
62 |
+
"import pandas as pd\n",
|
63 |
+
"import numpy as np\n",
|
64 |
+
"import seaborn as sn\n",
|
65 |
+
"import tensorflow as tf\n",
|
66 |
+
"from sklearn.model_selection import train_test_split"
|
67 |
+
]
|
68 |
+
},
|
69 |
+
{
|
70 |
+
"cell_type": "code",
|
71 |
+
"source": [
|
72 |
+
"# Load csv\n",
|
73 |
+
"data = pd.read_csv('/content/drive/MyDrive/LoanApprovalPrediction.csv')"
|
74 |
+
],
|
75 |
+
"metadata": {
|
76 |
+
"id": "naFm6bzI9lXw"
|
77 |
+
},
|
78 |
+
"execution_count": 4,
|
79 |
+
"outputs": []
|
80 |
+
},
|
81 |
+
{
|
82 |
+
"cell_type": "markdown",
|
83 |
+
"source": [
|
84 |
+
"## Data Cleaning"
|
85 |
+
],
|
86 |
+
"metadata": {
|
87 |
+
"id": "F0pZVXIJjmCW"
|
88 |
+
}
|
89 |
+
},
|
90 |
+
{
|
91 |
+
"cell_type": "code",
|
92 |
+
"source": [
|
93 |
+
"# Read the data\n",
|
94 |
+
"data.head()"
|
95 |
+
],
|
96 |
+
"metadata": {
|
97 |
+
"colab": {
|
98 |
+
"base_uri": "https://localhost:8080/",
|
99 |
+
"height": 288
|
100 |
+
},
|
101 |
+
"id": "3DB0GLEgnXpd",
|
102 |
+
"outputId": "a9fd2529-d4c7-4efd-f69a-560ba74f1873"
|
103 |
+
},
|
104 |
+
"execution_count": 5,
|
105 |
+
"outputs": [
|
106 |
+
{
|
107 |
+
"output_type": "execute_result",
|
108 |
+
"data": {
|
109 |
+
"text/plain": [
|
110 |
+
" Loan_ID Gender Married Dependents Education Self_Employed \\\n",
|
111 |
+
"0 LP001002 Male No 0.0 Graduate No \n",
|
112 |
+
"1 LP001003 Male Yes 1.0 Graduate No \n",
|
113 |
+
"2 LP001005 Male Yes 0.0 Graduate Yes \n",
|
114 |
+
"3 LP001006 Male Yes 0.0 Not Graduate No \n",
|
115 |
+
"4 LP001008 Male No 0.0 Graduate No \n",
|
116 |
+
"\n",
|
117 |
+
" ApplicantIncome CoapplicantIncome LoanAmount Loan_Amount_Term \\\n",
|
118 |
+
"0 5849 0.0 NaN 360.0 \n",
|
119 |
+
"1 4583 1508.0 128.0 360.0 \n",
|
120 |
+
"2 3000 0.0 66.0 360.0 \n",
|
121 |
+
"3 2583 2358.0 120.0 360.0 \n",
|
122 |
+
"4 6000 0.0 141.0 360.0 \n",
|
123 |
+
"\n",
|
124 |
+
" Credit_History Property_Area Loan_Status \n",
|
125 |
+
"0 1.0 Urban Y \n",
|
126 |
+
"1 1.0 Rural N \n",
|
127 |
+
"2 1.0 Urban Y \n",
|
128 |
+
"3 1.0 Urban Y \n",
|
129 |
+
"4 1.0 Urban Y "
|
130 |
+
],
|
131 |
+
"text/html": [
|
132 |
+
"\n",
|
133 |
+
"\n",
|
134 |
+
" <div id=\"df-5b22b868-a97e-44cc-a69e-b64d305d232d\">\n",
|
135 |
+
" <div class=\"colab-df-container\">\n",
|
136 |
+
" <div>\n",
|
137 |
+
"<style scoped>\n",
|
138 |
+
" .dataframe tbody tr th:only-of-type {\n",
|
139 |
+
" vertical-align: middle;\n",
|
140 |
+
" }\n",
|
141 |
+
"\n",
|
142 |
+
" .dataframe tbody tr th {\n",
|
143 |
+
" vertical-align: top;\n",
|
144 |
+
" }\n",
|
145 |
+
"\n",
|
146 |
+
" .dataframe thead th {\n",
|
147 |
+
" text-align: right;\n",
|
148 |
+
" }\n",
|
149 |
+
"</style>\n",
|
150 |
+
"<table border=\"1\" class=\"dataframe\">\n",
|
151 |
+
" <thead>\n",
|
152 |
+
" <tr style=\"text-align: right;\">\n",
|
153 |
+
" <th></th>\n",
|
154 |
+
" <th>Loan_ID</th>\n",
|
155 |
+
" <th>Gender</th>\n",
|
156 |
+
" <th>Married</th>\n",
|
157 |
+
" <th>Dependents</th>\n",
|
158 |
+
" <th>Education</th>\n",
|
159 |
+
" <th>Self_Employed</th>\n",
|
160 |
+
" <th>ApplicantIncome</th>\n",
|
161 |
+
" <th>CoapplicantIncome</th>\n",
|
162 |
+
" <th>LoanAmount</th>\n",
|
163 |
+
" <th>Loan_Amount_Term</th>\n",
|
164 |
+
" <th>Credit_History</th>\n",
|
165 |
+
" <th>Property_Area</th>\n",
|
166 |
+
" <th>Loan_Status</th>\n",
|
167 |
+
" </tr>\n",
|
168 |
+
" </thead>\n",
|
169 |
+
" <tbody>\n",
|
170 |
+
" <tr>\n",
|
171 |
+
" <th>0</th>\n",
|
172 |
+
" <td>LP001002</td>\n",
|
173 |
+
" <td>Male</td>\n",
|
174 |
+
" <td>No</td>\n",
|
175 |
+
" <td>0.0</td>\n",
|
176 |
+
" <td>Graduate</td>\n",
|
177 |
+
" <td>No</td>\n",
|
178 |
+
" <td>5849</td>\n",
|
179 |
+
" <td>0.0</td>\n",
|
180 |
+
" <td>NaN</td>\n",
|
181 |
+
" <td>360.0</td>\n",
|
182 |
+
" <td>1.0</td>\n",
|
183 |
+
" <td>Urban</td>\n",
|
184 |
+
" <td>Y</td>\n",
|
185 |
+
" </tr>\n",
|
186 |
+
" <tr>\n",
|
187 |
+
" <th>1</th>\n",
|
188 |
+
" <td>LP001003</td>\n",
|
189 |
+
" <td>Male</td>\n",
|
190 |
+
" <td>Yes</td>\n",
|
191 |
+
" <td>1.0</td>\n",
|
192 |
+
" <td>Graduate</td>\n",
|
193 |
+
" <td>No</td>\n",
|
194 |
+
" <td>4583</td>\n",
|
195 |
+
" <td>1508.0</td>\n",
|
196 |
+
" <td>128.0</td>\n",
|
197 |
+
" <td>360.0</td>\n",
|
198 |
+
" <td>1.0</td>\n",
|
199 |
+
" <td>Rural</td>\n",
|
200 |
+
" <td>N</td>\n",
|
201 |
+
" </tr>\n",
|
202 |
+
" <tr>\n",
|
203 |
+
" <th>2</th>\n",
|
204 |
+
" <td>LP001005</td>\n",
|
205 |
+
" <td>Male</td>\n",
|
206 |
+
" <td>Yes</td>\n",
|
207 |
+
" <td>0.0</td>\n",
|
208 |
+
" <td>Graduate</td>\n",
|
209 |
+
" <td>Yes</td>\n",
|
210 |
+
" <td>3000</td>\n",
|
211 |
+
" <td>0.0</td>\n",
|
212 |
+
" <td>66.0</td>\n",
|
213 |
+
" <td>360.0</td>\n",
|
214 |
+
" <td>1.0</td>\n",
|
215 |
+
" <td>Urban</td>\n",
|
216 |
+
" <td>Y</td>\n",
|
217 |
+
" </tr>\n",
|
218 |
+
" <tr>\n",
|
219 |
+
" <th>3</th>\n",
|
220 |
+
" <td>LP001006</td>\n",
|
221 |
+
" <td>Male</td>\n",
|
222 |
+
" <td>Yes</td>\n",
|
223 |
+
" <td>0.0</td>\n",
|
224 |
+
" <td>Not Graduate</td>\n",
|
225 |
+
" <td>No</td>\n",
|
226 |
+
" <td>2583</td>\n",
|
227 |
+
" <td>2358.0</td>\n",
|
228 |
+
" <td>120.0</td>\n",
|
229 |
+
" <td>360.0</td>\n",
|
230 |
+
" <td>1.0</td>\n",
|
231 |
+
" <td>Urban</td>\n",
|
232 |
+
" <td>Y</td>\n",
|
233 |
+
" </tr>\n",
|
234 |
+
" <tr>\n",
|
235 |
+
" <th>4</th>\n",
|
236 |
+
" <td>LP001008</td>\n",
|
237 |
+
" <td>Male</td>\n",
|
238 |
+
" <td>No</td>\n",
|
239 |
+
" <td>0.0</td>\n",
|
240 |
+
" <td>Graduate</td>\n",
|
241 |
+
" <td>No</td>\n",
|
242 |
+
" <td>6000</td>\n",
|
243 |
+
" <td>0.0</td>\n",
|
244 |
+
" <td>141.0</td>\n",
|
245 |
+
" <td>360.0</td>\n",
|
246 |
+
" <td>1.0</td>\n",
|
247 |
+
" <td>Urban</td>\n",
|
248 |
+
" <td>Y</td>\n",
|
249 |
+
" </tr>\n",
|
250 |
+
" </tbody>\n",
|
251 |
+
"</table>\n",
|
252 |
+
"</div>\n",
|
253 |
+
" <button class=\"colab-df-convert\" onclick=\"convertToInteractive('df-5b22b868-a97e-44cc-a69e-b64d305d232d')\"\n",
|
254 |
+
" title=\"Convert this dataframe to an interactive table.\"\n",
|
255 |
+
" style=\"display:none;\">\n",
|
256 |
+
"\n",
|
257 |
+
" <svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
|
258 |
+
" width=\"24px\">\n",
|
259 |
+
" <path d=\"M0 0h24v24H0V0z\" fill=\"none\"/>\n",
|
260 |
+
" <path d=\"M18.56 5.44l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94zm-11 1L8.5 8.5l.94-2.06 2.06-.94-2.06-.94L8.5 2.5l-.94 2.06-2.06.94zm10 10l.94 2.06.94-2.06 2.06-.94-2.06-.94-.94-2.06-.94 2.06-2.06.94z\"/><path d=\"M17.41 7.96l-1.37-1.37c-.4-.4-.92-.59-1.43-.59-.52 0-1.04.2-1.43.59L10.3 9.45l-7.72 7.72c-.78.78-.78 2.05 0 2.83L4 21.41c.39.39.9.59 1.41.59.51 0 1.02-.2 1.41-.59l7.78-7.78 2.81-2.81c.8-.78.8-2.07 0-2.86zM5.41 20L4 18.59l7.72-7.72 1.47 1.35L5.41 20z\"/>\n",
|
261 |
+
" </svg>\n",
|
262 |
+
" </button>\n",
|
263 |
+
"\n",
|
264 |
+
"\n",
|
265 |
+
"\n",
|
266 |
+
" <div id=\"df-b37c8fa9-dbcd-450f-9341-50c75e7abbf6\">\n",
|
267 |
+
" <button class=\"colab-df-quickchart\" onclick=\"quickchart('df-b37c8fa9-dbcd-450f-9341-50c75e7abbf6')\"\n",
|
268 |
+
" title=\"Suggest charts.\"\n",
|
269 |
+
" style=\"display:none;\">\n",
|
270 |
+
"\n",
|
271 |
+
"<svg xmlns=\"http://www.w3.org/2000/svg\" height=\"24px\"viewBox=\"0 0 24 24\"\n",
|
272 |
+
" width=\"24px\">\n",
|
273 |
+
" <g>\n",
|
274 |
+
" <path d=\"M19 3H5c-1.1 0-2 .9-2 2v14c0 1.1.9 2 2 2h14c1.1 0 2-.9 2-2V5c0-1.1-.9-2-2-2zM9 17H7v-7h2v7zm4 0h-2V7h2v10zm4 0h-2v-4h2v4z\"/>\n",
|
275 |
+
" </g>\n",
|
276 |
+
"</svg>\n",
|
277 |
+
" </button>\n",
|
278 |
+
" </div>\n",
|
279 |
+
"\n",
|
280 |
+
"<style>\n",
|
281 |
+
" .colab-df-quickchart {\n",
|
282 |
+
" background-color: #E8F0FE;\n",
|
283 |
+
" border: none;\n",
|
284 |
+
" border-radius: 50%;\n",
|
285 |
+
" cursor: pointer;\n",
|
286 |
+
" display: none;\n",
|
287 |
+
" fill: #1967D2;\n",
|
288 |
+
" height: 32px;\n",
|
289 |
+
" padding: 0 0 0 0;\n",
|
290 |
+
" width: 32px;\n",
|
291 |
+
" }\n",
|
292 |
+
"\n",
|
293 |
+
" .colab-df-quickchart:hover {\n",
|
294 |
+
" background-color: #E2EBFA;\n",
|
295 |
+
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
|
296 |
+
" fill: #174EA6;\n",
|
297 |
+
" }\n",
|
298 |
+
"\n",
|
299 |
+
" [theme=dark] .colab-df-quickchart {\n",
|
300 |
+
" background-color: #3B4455;\n",
|
301 |
+
" fill: #D2E3FC;\n",
|
302 |
+
" }\n",
|
303 |
+
"\n",
|
304 |
+
" [theme=dark] .colab-df-quickchart:hover {\n",
|
305 |
+
" background-color: #434B5C;\n",
|
306 |
+
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
|
307 |
+
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
|
308 |
+
" fill: #FFFFFF;\n",
|
309 |
+
" }\n",
|
310 |
+
"</style>\n",
|
311 |
+
"\n",
|
312 |
+
" <script>\n",
|
313 |
+
" async function quickchart(key) {\n",
|
314 |
+
" const containerElement = document.querySelector('#' + key);\n",
|
315 |
+
" const charts = await google.colab.kernel.invokeFunction(\n",
|
316 |
+
" 'suggestCharts', [key], {});\n",
|
317 |
+
" }\n",
|
318 |
+
" </script>\n",
|
319 |
+
"\n",
|
320 |
+
" <script>\n",
|
321 |
+
"\n",
|
322 |
+
"function displayQuickchartButton(domScope) {\n",
|
323 |
+
" let quickchartButtonEl =\n",
|
324 |
+
" domScope.querySelector('#df-b37c8fa9-dbcd-450f-9341-50c75e7abbf6 button.colab-df-quickchart');\n",
|
325 |
+
" quickchartButtonEl.style.display =\n",
|
326 |
+
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
|
327 |
+
"}\n",
|
328 |
+
"\n",
|
329 |
+
" displayQuickchartButton(document);\n",
|
330 |
+
" </script>\n",
|
331 |
+
" <style>\n",
|
332 |
+
" .colab-df-container {\n",
|
333 |
+
" display:flex;\n",
|
334 |
+
" flex-wrap:wrap;\n",
|
335 |
+
" gap: 12px;\n",
|
336 |
+
" }\n",
|
337 |
+
"\n",
|
338 |
+
" .colab-df-convert {\n",
|
339 |
+
" background-color: #E8F0FE;\n",
|
340 |
+
" border: none;\n",
|
341 |
+
" border-radius: 50%;\n",
|
342 |
+
" cursor: pointer;\n",
|
343 |
+
" display: none;\n",
|
344 |
+
" fill: #1967D2;\n",
|
345 |
+
" height: 32px;\n",
|
346 |
+
" padding: 0 0 0 0;\n",
|
347 |
+
" width: 32px;\n",
|
348 |
+
" }\n",
|
349 |
+
"\n",
|
350 |
+
" .colab-df-convert:hover {\n",
|
351 |
+
" background-color: #E2EBFA;\n",
|
352 |
+
" box-shadow: 0px 1px 2px rgba(60, 64, 67, 0.3), 0px 1px 3px 1px rgba(60, 64, 67, 0.15);\n",
|
353 |
+
" fill: #174EA6;\n",
|
354 |
+
" }\n",
|
355 |
+
"\n",
|
356 |
+
" [theme=dark] .colab-df-convert {\n",
|
357 |
+
" background-color: #3B4455;\n",
|
358 |
+
" fill: #D2E3FC;\n",
|
359 |
+
" }\n",
|
360 |
+
"\n",
|
361 |
+
" [theme=dark] .colab-df-convert:hover {\n",
|
362 |
+
" background-color: #434B5C;\n",
|
363 |
+
" box-shadow: 0px 1px 3px 1px rgba(0, 0, 0, 0.15);\n",
|
364 |
+
" filter: drop-shadow(0px 1px 2px rgba(0, 0, 0, 0.3));\n",
|
365 |
+
" fill: #FFFFFF;\n",
|
366 |
+
" }\n",
|
367 |
+
" </style>\n",
|
368 |
+
"\n",
|
369 |
+
" <script>\n",
|
370 |
+
" const buttonEl =\n",
|
371 |
+
" document.querySelector('#df-5b22b868-a97e-44cc-a69e-b64d305d232d button.colab-df-convert');\n",
|
372 |
+
" buttonEl.style.display =\n",
|
373 |
+
" google.colab.kernel.accessAllowed ? 'block' : 'none';\n",
|
374 |
+
"\n",
|
375 |
+
" async function convertToInteractive(key) {\n",
|
376 |
+
" const element = document.querySelector('#df-5b22b868-a97e-44cc-a69e-b64d305d232d');\n",
|
377 |
+
" const dataTable =\n",
|
378 |
+
" await google.colab.kernel.invokeFunction('convertToInteractive',\n",
|
379 |
+
" [key], {});\n",
|
380 |
+
" if (!dataTable) return;\n",
|
381 |
+
"\n",
|
382 |
+
" const docLinkHtml = 'Like what you see? Visit the ' +\n",
|
383 |
+
" '<a target=\"_blank\" href=https://colab.research.google.com/notebooks/data_table.ipynb>data table notebook</a>'\n",
|
384 |
+
" + ' to learn more about interactive tables.';\n",
|
385 |
+
" element.innerHTML = '';\n",
|
386 |
+
" dataTable['output_type'] = 'display_data';\n",
|
387 |
+
" await google.colab.output.renderOutput(dataTable, element);\n",
|
388 |
+
" const docLink = document.createElement('div');\n",
|
389 |
+
" docLink.innerHTML = docLinkHtml;\n",
|
390 |
+
" element.appendChild(docLink);\n",
|
391 |
+
" }\n",
|
392 |
+
" </script>\n",
|
393 |
+
" </div>\n",
|
394 |
+
" </div>\n"
|
395 |
+
]
|
396 |
+
},
|
397 |
+
"metadata": {},
|
398 |
+
"execution_count": 5
|
399 |
+
}
|
400 |
+
]
|
401 |
+
},
|
402 |
+
{
|
403 |
+
"cell_type": "code",
|
404 |
+
"source": [
|
405 |
+
"# Get data info\n",
|
406 |
+
"def table_info(data):\n",
|
407 |
+
" print(f'Num Rows :- {data.shape[0]} , Num Colm :- {data.shape[1]}')\n",
|
408 |
+
" print(\"\\nTable DataTypes :\\n\",data.dtypes)\n",
|
409 |
+
" print(\"\\nColumn names :\",data.columns.values)"
|
410 |
+
],
|
411 |
+
"metadata": {
|
412 |
+
"id": "FWR-opXwC29t"
|
413 |
+
},
|
414 |
+
"execution_count": 21,
|
415 |
+
"outputs": []
|
416 |
+
},
|
417 |
+
{
|
418 |
+
"cell_type": "code",
|
419 |
+
"source": [
|
420 |
+
"table_info(data)"
|
421 |
+
],
|
422 |
+
"metadata": {
|
423 |
+
"colab": {
|
424 |
+
"base_uri": "https://localhost:8080/"
|
425 |
+
},
|
426 |
+
"id": "DsI9WjmDpGU8",
|
427 |
+
"outputId": "cebad37b-3013-4c83-89e8-82c6b6baa0d9"
|
428 |
+
},
|
429 |
+
"execution_count": 22,
|
430 |
+
"outputs": [
|
431 |
+
{
|
432 |
+
"output_type": "stream",
|
433 |
+
"name": "stdout",
|
434 |
+
"text": [
|
435 |
+
"Num Rows :- 598 , Num Colm :- 13\n",
|
436 |
+
"\n",
|
437 |
+
"Table DataTypes :\n",
|
438 |
+
" Loan_ID object\n",
|
439 |
+
"Gender object\n",
|
440 |
+
"Married object\n",
|
441 |
+
"Dependents float64\n",
|
442 |
+
"Education object\n",
|
443 |
+
"Self_Employed object\n",
|
444 |
+
"ApplicantIncome int64\n",
|
445 |
+
"CoapplicantIncome float64\n",
|
446 |
+
"LoanAmount float64\n",
|
447 |
+
"Loan_Amount_Term float64\n",
|
448 |
+
"Credit_History float64\n",
|
449 |
+
"Property_Area object\n",
|
450 |
+
"Loan_Status object\n",
|
451 |
+
"dtype: object\n",
|
452 |
+
"\n",
|
453 |
+
"Column names : ['Loan_ID' 'Gender' 'Married' 'Dependents' 'Education' 'Self_Employed'\n",
|
454 |
+
" 'ApplicantIncome' 'CoapplicantIncome' 'LoanAmount' 'Loan_Amount_Term'\n",
|
455 |
+
" 'Credit_History' 'Property_Area' 'Loan_Status']\n"
|
456 |
+
]
|
457 |
+
}
|
458 |
+
]
|
459 |
+
},
|
460 |
+
{
|
461 |
+
"cell_type": "markdown",
|
462 |
+
"source": [
|
463 |
+
"### Problem :-Now that we have seen the data we can clearly see an issue of 2 datatypes in the dataset , so we"
|
464 |
+
],
|
465 |
+
"metadata": {
|
466 |
+
"id": "X8R0kj4NpmAd"
|
467 |
+
}
|
468 |
+
},
|
469 |
+
{
|
470 |
+
"cell_type": "code",
|
471 |
+
"source": [],
|
472 |
+
"metadata": {
|
473 |
+
"id": "iu_jXgwSplk1"
|
474 |
+
},
|
475 |
+
"execution_count": null,
|
476 |
+
"outputs": []
|
477 |
+
},
|
478 |
+
{
|
479 |
+
"cell_type": "code",
|
480 |
+
"source": [
|
481 |
+
"# Dropping Loan_ID column\n",
|
482 |
+
"data.drop(['Loan_ID'],axis=1,inplace=True)"
|
483 |
+
],
|
484 |
+
"metadata": {
|
485 |
+
"id": "dKQsm4QLF0KF"
|
486 |
+
},
|
487 |
+
"execution_count": null,
|
488 |
+
"outputs": []
|
489 |
+
},
|
490 |
+
{
|
491 |
+
"cell_type": "code",
|
492 |
+
"source": [
|
493 |
+
"#"
|
494 |
+
],
|
495 |
+
"metadata": {
|
496 |
+
"id": "0oocAPzrXinS"
|
497 |
+
},
|
498 |
+
"execution_count": null,
|
499 |
+
"outputs": []
|
500 |
+
}
|
501 |
+
]
|
502 |
+
}
|