Update test_dataset.py
Browse files- test_dataset.py +22 -22
test_dataset.py
CHANGED
|
@@ -63,17 +63,17 @@ class NewDataset(datasets.GeneratorBasedBuilder):
|
|
| 63 |
description=_DESCRIPTION,
|
| 64 |
features=datasets.Features(
|
| 65 |
{
|
| 66 |
-
"
|
| 67 |
-
"
|
| 68 |
-
"
|
| 69 |
-
"
|
| 70 |
-
"
|
| 71 |
-
"
|
| 72 |
-
"
|
| 73 |
-
"
|
| 74 |
-
"
|
| 75 |
-
"
|
| 76 |
-
"
|
| 77 |
# These are the features of your dataset like images, labels ...
|
| 78 |
}
|
| 79 |
),
|
|
@@ -101,20 +101,20 @@ class NewDataset(datasets.GeneratorBasedBuilder):
|
|
| 101 |
reader = csv.DictReader(f)
|
| 102 |
for key, row in enumerate(reader):
|
| 103 |
yield key, {
|
| 104 |
-
"
|
| 105 |
-
"
|
| 106 |
-
"
|
| 107 |
-
"
|
| 108 |
"latitude": float(row["latitude"]),
|
| 109 |
"longitude": float(row["longitude"])
|
| 110 |
},
|
| 111 |
-
"
|
| 112 |
-
"
|
| 113 |
-
"
|
| 114 |
-
"
|
| 115 |
-
"
|
| 116 |
-
"
|
| 117 |
-
"
|
| 118 |
}
|
| 119 |
|
| 120 |
@staticmethod
|
|
|
|
| 63 |
description=_DESCRIPTION,
|
| 64 |
features=datasets.Features(
|
| 65 |
{
|
| 66 |
+
"Year": datasets.Value("int32"),
|
| 67 |
+
"LocationAbbr": datasets.Value("string"),
|
| 68 |
+
"LocationDesc": datasets.Value("string"),
|
| 69 |
+
"Geolocation": datasets.Features({"latitude": datasets.Value("float32"), "longitude": datasets.Value("float32")}),
|
| 70 |
+
"Disease_Type": datasets.Value("int32"),
|
| 71 |
+
"Data_Value_Type": datasets.Value("int32"),
|
| 72 |
+
"Data_Value": datasets.Value("float32"),
|
| 73 |
+
"Break_Out_Category": datasets.Value("string"),
|
| 74 |
+
"Break_Out_Details": datasets.Value("string"),
|
| 75 |
+
"Break_Out_Type": datasets.Value("int32"),
|
| 76 |
+
"Life_Expectancy": datasets.Value("float32")
|
| 77 |
# These are the features of your dataset like images, labels ...
|
| 78 |
}
|
| 79 |
),
|
|
|
|
| 101 |
reader = csv.DictReader(f)
|
| 102 |
for key, row in enumerate(reader):
|
| 103 |
yield key, {
|
| 104 |
+
"Year": int(row["Year"]),
|
| 105 |
+
"Location_Abbr": row["LocationAbbr"],
|
| 106 |
+
"Location_Desc": row["LocationDesc"],
|
| 107 |
+
"Geolocation": {
|
| 108 |
"latitude": float(row["latitude"]),
|
| 109 |
"longitude": float(row["longitude"])
|
| 110 |
},
|
| 111 |
+
"Disease_Type": int(row["Disease_Type"]),
|
| 112 |
+
"Data_Value_Type": int(row["Data_Value_Type"]),
|
| 113 |
+
"Data_Value": float(row["Data_Value"]),
|
| 114 |
+
"Break_Out_Category": row["Break_Out_Category"],
|
| 115 |
+
"Break_Out_Details": row["Break_Out_Details"],
|
| 116 |
+
"Break_Out_Type": int(row["Break_Out_Type"]),
|
| 117 |
+
"Life_Expectancy": float(row["Life_Expectancy"]) if row["Life_Expectancy"] else None
|
| 118 |
}
|
| 119 |
|
| 120 |
@staticmethod
|