Datasets:
Upload compas.py
Browse files
compas.py
CHANGED
@@ -204,9 +204,8 @@ class Compas(datasets.GeneratorBasedBuilder):
|
|
204 |
|
205 |
def _generate_examples(self, filepath: str):
|
206 |
data = pandas.read_csv(filepath)
|
207 |
-
print("preprocessing...")
|
208 |
data = self.preprocess(data, config=self.config.name)
|
209 |
-
print(
|
210 |
|
211 |
for row_id, row in data.iterrows():
|
212 |
data_row = dict(row)
|
@@ -214,7 +213,6 @@ class Compas(datasets.GeneratorBasedBuilder):
|
|
214 |
yield row_id, data_row
|
215 |
|
216 |
def preprocess(self, data: pandas.DataFrame, config: str = "income") -> pandas.DataFrame:
|
217 |
-
print("dropping columns...")
|
218 |
data.drop("id", axis="columns", inplace=True)
|
219 |
data.drop("name", axis="columns", inplace=True)
|
220 |
data.drop("first", axis="columns", inplace=True)
|
@@ -267,7 +265,6 @@ class Compas(datasets.GeneratorBasedBuilder):
|
|
267 |
data.drop("in_custody", axis="columns", inplace=True)
|
268 |
data.drop("out_custody", axis="columns", inplace=True)
|
269 |
|
270 |
-
print(data.columns)
|
271 |
data = data[["sex",
|
272 |
"age",
|
273 |
"race",
|
|
|
204 |
|
205 |
def _generate_examples(self, filepath: str):
|
206 |
data = pandas.read_csv(filepath)
|
|
|
207 |
data = self.preprocess(data, config=self.config.name)
|
208 |
+
print(data.dtypes)
|
209 |
|
210 |
for row_id, row in data.iterrows():
|
211 |
data_row = dict(row)
|
|
|
213 |
yield row_id, data_row
|
214 |
|
215 |
def preprocess(self, data: pandas.DataFrame, config: str = "income") -> pandas.DataFrame:
|
|
|
216 |
data.drop("id", axis="columns", inplace=True)
|
217 |
data.drop("name", axis="columns", inplace=True)
|
218 |
data.drop("first", axis="columns", inplace=True)
|
|
|
265 |
data.drop("in_custody", axis="columns", inplace=True)
|
266 |
data.drop("out_custody", axis="columns", inplace=True)
|
267 |
|
|
|
268 |
data = data[["sex",
|
269 |
"age",
|
270 |
"race",
|