forked from A7mad7sn/Loan-Prediction
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGetter.py
106 lines (92 loc) · 3.6 KB
/
Getter.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
def FeaturesGetter():
#Getting Features from User :-
print('--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------\n')
print(' Enter your Values to Predict : ' )
ID = input('--> Loan ID : ')
Gender = input('--> Gender (Male/Female) : ')
if (Gender.lower() == 'male'):
Gender = 1
elif(Gender.lower() == 'female'):
Gender = 0
else:
print('Invalid Gender it Will be "Male" by default !')
Gender = 1
Married = input('--> Married (Yes/No) : ')
if (Married.lower() == 'yes'):
Married = 1
elif(Married.lower() == 'no'):
Married = 0
else:
print('Invalid Status it Will be "No" by default !')
Married = 0
while(True):
Dependents = input('--> Num of Dependents : ')
if Dependents.isnumeric() == False:
print ('Please Enter Only Numeric Data !')
continue
else:
break
Education = input('--> Education (Graduate/Not Graduate) : ')
if (Education.lower() == 'graduate'):
Education = 0
elif(Education.lower() == 'not graduate'):
Education = 1
else:
print('Invalid Education it Will be "Graduate" by default !')
Education = 0
Self_Employed = input('--> Self_Employed (Yes/No) : ')
if (Self_Employed.lower() == 'yes'):
Self_Employed = 1
elif(Self_Employed.lower() == 'no'):
Self_Employed = 0
else:
print('Invalid status it Will be "Yes" by default !')
Self_Employed = 1
while(True):
ApplicantIncome = input('--> ApplicantIncome : ')
if ApplicantIncome.isnumeric() == False:
print ('Please Enter Only Numeric Data !')
continue
else:
break
while(True):
CoapplicantIncome = input('--> CoapplicantIncome : ')
if CoapplicantIncome.isnumeric() == False:
print ('Please Enter Only Numeric Data !')
continue
else:
break
while(True):
LoanAmount = input('--> LoanAmount : ')
if LoanAmount.isnumeric() == False:
print ('Please Enter Only Numeric Data !')
continue
else:
break
while(True):
Loan_Amount_Term = input('--> Loan_Amount_Term : ')
if Loan_Amount_Term.isnumeric() == False:
print ('Please Enter Only Numeric Data !')
continue
else:
break
while(True):
Credit_History = input('--> Credit_History (1/0) : ')
if Credit_History.isnumeric() == False:
print ('Please Enter Only Numeric Data (1 Or 0) !')
continue
else:
break
Property_Area = input('--> Property_Area (Urban/Rural/Semiurban) : ')
if (Property_Area.lower() == 'urban'):
Property_Area = 2
elif(Property_Area.lower() == 'rural'):
Property_Area = 0
elif(Property_Area.lower() == 'semiurban'):
Property_Area = 1
else:
print('Invalid Property , it will be "Urban" by default')
Property_Area = 2
#Collecting them into on Variable :-
features = [[Married,Dependents,Education,Self_Employed,CoapplicantIncome,Credit_History,Property_Area]]#only features selected by 'SelectPercentile'
return features