mstz commited on
Commit
0aed351
1 Parent(s): 0b95dbe

Upload nbfi.py

Browse files
Files changed (1) hide show
  1. nbfi.py +9 -2
nbfi.py CHANGED
@@ -218,12 +218,15 @@ class NBFI(datasets.GeneratorBasedBuilder):
218
  data = data[~data.Application_Process_Hour.isna()]
219
  data = data[~data.Client_Permanent_Match_Tag.isna()]
220
  data = data[~data.Client_Contact_Work_Tag.isna()]
 
 
 
 
221
 
222
  data.columns = _BASE_FEATURE_NAMES
223
 
224
  data["education_level"] = data["education_level"].apply(lambda x: _EDUCATION_ENCODING[x])
225
  data["is_male"] = data["is_male"].apply(lambda x: x == "M")
226
- data = data.astype({"is_male": "bool"})
227
  data["owns_a_car"] = data["owns_a_car"].apply(bool)
228
  data["owns_a_bike"] = data["owns_a_bike"].apply(bool)
229
  data["has_an_active_loan"] = data["has_an_active_loan"].apply(bool)
@@ -235,7 +238,11 @@ class NBFI(datasets.GeneratorBasedBuilder):
235
  data["same_residence_and_home"] = data["same_residence_and_home"].apply(bool)
236
  data["same_work_and_home"] = data["same_work_and_home"].apply(bool)
237
 
238
- print(data.head())
 
 
 
 
239
 
240
  return data[list(features_types_per_config[config].keys())]
241
 
 
218
  data = data[~data.Application_Process_Hour.isna()]
219
  data = data[~data.Client_Permanent_Match_Tag.isna()]
220
  data = data[~data.Client_Contact_Work_Tag.isna()]
221
+ data = data[~data.Score_Source_1.isna()]
222
+ data = data[~data.Score_Source_2.isna()]
223
+ data = data[~data.Score_Source_3.isna()]
224
+ data = data[~data.Credit_Bureau.isna()]
225
 
226
  data.columns = _BASE_FEATURE_NAMES
227
 
228
  data["education_level"] = data["education_level"].apply(lambda x: _EDUCATION_ENCODING[x])
229
  data["is_male"] = data["is_male"].apply(lambda x: x == "M")
 
230
  data["owns_a_car"] = data["owns_a_car"].apply(bool)
231
  data["owns_a_bike"] = data["owns_a_bike"].apply(bool)
232
  data["has_an_active_loan"] = data["has_an_active_loan"].apply(bool)
 
238
  data["same_residence_and_home"] = data["same_residence_and_home"].apply(bool)
239
  data["same_work_and_home"] = data["same_work_and_home"].apply(bool)
240
 
241
+ data = data.astype({
242
+ "is_male": "bool",
243
+ "nr_children": "int8"
244
+ })
245
+ print([f for f in data.columns if "M" in data[f]])
246
 
247
  return data[list(features_types_per_config[config].keys())]
248