mstz commited on
Commit
e8b1107
·
1 Parent(s): 602f0c9

Upload student_performance.py

Browse files
Files changed (1) hide show
  1. student_performance.py +2 -7
student_performance.py CHANGED
@@ -21,7 +21,7 @@ _BASE_FEATURE_NAMES = [
21
  ]
22
 
23
  _ENCODING_DICS = {
24
- "gender": {
25
  "female": 0,
26
  "male": 1
27
  },
@@ -142,15 +142,10 @@ class StudentPerformance(datasets.GeneratorBasedBuilder):
142
  if config == "encoding":
143
  return self.encoding_dics()
144
 
145
- data.columns = [c.replace("\"", "") for c in data.columns]
146
-
147
- data.loc[:, "race/ethnicity"] = data["race/ethnicity"].apply(lambda x: x.replace("group ", ""))
148
-
149
  for feature in _ENCODING_DICS:
150
  encoding_function = partial(self.encode, feature)
151
  data.loc[:, feature] = data[feature].apply(encoding_function)
152
-
153
- data.columns = _BASE_FEATURE_NAMES
154
 
155
  if config == "math":
156
  data = data.rename(colums={"math_score", "has_passed_math_exam"})
 
21
  ]
22
 
23
  _ENCODING_DICS = {
24
+ "sex": {
25
  "female": 0,
26
  "male": 1
27
  },
 
142
  if config == "encoding":
143
  return self.encoding_dics()
144
 
145
+ data.columns = _BASE_FEATURE_NAMES
 
 
 
146
  for feature in _ENCODING_DICS:
147
  encoding_function = partial(self.encode, feature)
148
  data.loc[:, feature] = data[feature].apply(encoding_function)
 
 
149
 
150
  if config == "math":
151
  data = data.rename(colums={"math_score", "has_passed_math_exam"})