Datasets:
Update liver.py
Browse files
liver.py
CHANGED
|
@@ -27,7 +27,7 @@ urls_per_split = {
|
|
| 27 |
}
|
| 28 |
features_types_per_config = {
|
| 29 |
"liver": {
|
| 30 |
-
"age": datasets.Value("
|
| 31 |
"is_male": datasets.Value("bool"),
|
| 32 |
"total_bilirubin": datasets.Value("float64"),
|
| 33 |
"direct_ribilubin": datasets.Value("float64"),
|
|
@@ -73,9 +73,8 @@ class ILPD(datasets.GeneratorBasedBuilder):
|
|
| 73 |
def _generate_examples(self, filepath: str):
|
| 74 |
data = pandas.read_csv(filepath).infer_objects()
|
| 75 |
data[["is_male"]].applymap(bool)
|
| 76 |
-
data[["class"]
|
| 77 |
data = data.astype({"is_male": "bool"})
|
| 78 |
-
print(data.dtypes)
|
| 79 |
|
| 80 |
for row_id, row in data.iterrows():
|
| 81 |
data_row = dict(row)
|
|
|
|
| 27 |
}
|
| 28 |
features_types_per_config = {
|
| 29 |
"liver": {
|
| 30 |
+
"age": datasets.Value("int64"),
|
| 31 |
"is_male": datasets.Value("bool"),
|
| 32 |
"total_bilirubin": datasets.Value("float64"),
|
| 33 |
"direct_ribilubin": datasets.Value("float64"),
|
|
|
|
| 73 |
def _generate_examples(self, filepath: str):
|
| 74 |
data = pandas.read_csv(filepath).infer_objects()
|
| 75 |
data[["is_male"]].applymap(bool)
|
| 76 |
+
data.loc[:, "class"] = data["class"].apply(lambda x: x - 1)
|
| 77 |
data = data.astype({"is_male": "bool"})
|
|
|
|
| 78 |
|
| 79 |
for row_id, row in data.iterrows():
|
| 80 |
data_row = dict(row)
|