Datasets:
Upload student_performance.py
Browse files- student_performance.py +6 -0
student_performance.py
CHANGED
@@ -149,12 +149,18 @@ class StudentPerformance(datasets.GeneratorBasedBuilder):
|
|
149 |
|
150 |
if config == "math":
|
151 |
data = data.rename(columns={"math_score": "has_passed_math_exam"})
|
|
|
|
|
152 |
return data[list(features_types_per_config["math"].keys())]
|
153 |
elif config == "reading":
|
154 |
data = data.rename(columns={"reading_score": "has_passed_reading_exam"})
|
|
|
|
|
155 |
return data[list(features_types_per_config["reading"].keys())]
|
156 |
elif config == "writing":
|
157 |
data = data.rename(columns={"writing_score": "has_passed_writing_exam"})
|
|
|
|
|
158 |
return data[list(features_types_per_config["writing"].keys())]
|
159 |
else:
|
160 |
raise ValueError(f"Unknown config: {config}")
|
|
|
149 |
|
150 |
if config == "math":
|
151 |
data = data.rename(columns={"math_score": "has_passed_math_exam"})
|
152 |
+
data.loc[:, "has_passed_math_exam"] = data.has_passed_math_exam.apply(lambda x: int(x > 60))
|
153 |
+
|
154 |
return data[list(features_types_per_config["math"].keys())]
|
155 |
elif config == "reading":
|
156 |
data = data.rename(columns={"reading_score": "has_passed_reading_exam"})
|
157 |
+
data.loc[:, "has_passed_reading_exam"] = data.has_passed_reading_exam.apply(lambda x: int(x > 60))
|
158 |
+
|
159 |
return data[list(features_types_per_config["reading"].keys())]
|
160 |
elif config == "writing":
|
161 |
data = data.rename(columns={"writing_score": "has_passed_writing_exam"})
|
162 |
+
data.loc[:, "has_passed_writing_exam"] = data.has_passed_writing_exam.apply(lambda x: int(x > 60))
|
163 |
+
|
164 |
return data[list(features_types_per_config["writing"].keys())]
|
165 |
else:
|
166 |
raise ValueError(f"Unknown config: {config}")
|