Update NC_Crime.py
Browse files- NC_Crime.py +3 -3
NC_Crime.py
CHANGED
@@ -63,7 +63,7 @@ class NCCrimeDataset(datasets.GeneratorBasedBuilder):
|
|
63 |
description=_DESCRIPTION,
|
64 |
features=datasets.Features(
|
65 |
{
|
66 |
-
|
67 |
"city": datasets.Value("string"),
|
68 |
"crime_major_category": datasets.Value("string"),
|
69 |
"crime_detail": datasets.Value("string"),
|
@@ -80,7 +80,7 @@ class NCCrimeDataset(datasets.GeneratorBasedBuilder):
|
|
80 |
def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
|
81 |
# Use the raw GitHub link to download the CSV file
|
82 |
downloaded_file_path = dl_manager.download_and_extract(
|
83 |
-
"https://raw.githubusercontent.com/zening-wang2023/NC-Crime-Dataset/main/
|
84 |
|
85 |
# Return a list of split generators
|
86 |
return [
|
@@ -94,7 +94,7 @@ class NCCrimeDataset(datasets.GeneratorBasedBuilder):
|
|
94 |
# Iterate over the rows and yield examples
|
95 |
for i, row in df.iterrows():
|
96 |
yield i, {
|
97 |
-
|
98 |
"city": row["city"],
|
99 |
"crime_major_category": row["crime_major_category"],
|
100 |
"crime_detail": row["crime_detail"],
|
|
|
63 |
description=_DESCRIPTION,
|
64 |
features=datasets.Features(
|
65 |
{
|
66 |
+
"year": datasets.Value("int64"),
|
67 |
"city": datasets.Value("string"),
|
68 |
"crime_major_category": datasets.Value("string"),
|
69 |
"crime_detail": datasets.Value("string"),
|
|
|
80 |
def _split_generators(self, dl_manager: datasets.DownloadManager) -> List[datasets.SplitGenerator]:
|
81 |
# Use the raw GitHub link to download the CSV file
|
82 |
downloaded_file_path = dl_manager.download_and_extract(
|
83 |
+
"https://raw.githubusercontent.com/zening-wang2023/NC-Crime-Dataset/main/NC_test.csv")
|
84 |
|
85 |
# Return a list of split generators
|
86 |
return [
|
|
|
94 |
# Iterate over the rows and yield examples
|
95 |
for i, row in df.iterrows():
|
96 |
yield i, {
|
97 |
+
"year": int(row["year"]),
|
98 |
"city": row["city"],
|
99 |
"crime_major_category": row["crime_major_category"],
|
100 |
"crime_detail": row["crime_detail"],
|