Upload folder using huggingface_hub
Browse files- .gitattributes +1 -0
- NYC_Motor_Vehicle_Collisions_Mar_12_2025.csv +3 -0
- README.md +3 -3
- dataset_script.py +52 -0
.gitattributes
CHANGED
|
@@ -57,3 +57,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
|
|
| 57 |
# Video files - compressed
|
| 58 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 59 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
|
|
|
|
|
| 57 |
# Video files - compressed
|
| 58 |
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
| 59 |
*.webm filter=lfs diff=lfs merge=lfs -text
|
| 60 |
+
NYC_Motor_Vehicle_Collisions_Mar_12_2025.csv filter=lfs diff=lfs merge=lfs -text
|
NYC_Motor_Vehicle_Collisions_Mar_12_2025.csv
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:272d151d599d6f302d0911a8faec6aa60710cd66ab2881385163496984b26b6e
|
| 3 |
+
size 456361850
|
README.md
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
-
|
| 2 |
-
|
| 3 |
-
-
|
|
|
|
| 1 |
+
# NYC Vehicle Collisions
|
| 2 |
+
|
| 3 |
+
Note:This data can not be loaded using load_data(). This dataset contains detailed records of motor vehicle collisions in New York City, collected by the NYPD. It includes information such as the date and time of the incident, location (borough, latitude, longitude), contributing factors, types of vehicles involved, and counts of persons injured or killed. It is a vital resource for traffic safety analysis, urban planning, and policy-making related to transportation and public health.
|
dataset_script.py
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import csv
|
| 2 |
+
import datasets
|
| 3 |
+
|
| 4 |
+
class GenericCSVLoader(datasets.GeneratorBasedBuilder):
|
| 5 |
+
def _info(self):
|
| 6 |
+
return datasets.DatasetInfo(
|
| 7 |
+
description="Generic CSV loader script for Hugging Face Datasets.",
|
| 8 |
+
features=datasets.Features({
|
| 9 |
+
"CRASH DATE": datasets.Value("string"),
|
| 10 |
+
"CRASH TIME": datasets.Value("string"),
|
| 11 |
+
"BOROUGH": datasets.Value("string"),
|
| 12 |
+
"ZIP CODE": datasets.Value("string"),
|
| 13 |
+
"LATITUDE": datasets.Value("string"),
|
| 14 |
+
"LONGITUDE": datasets.Value("string"),
|
| 15 |
+
"LOCATION": datasets.Value("string"),
|
| 16 |
+
"ON STREET NAME": datasets.Value("string"),
|
| 17 |
+
"CROSS STREET NAME": datasets.Value("string"),
|
| 18 |
+
"OFF STREET NAME": datasets.Value("string"),
|
| 19 |
+
"NUMBER OF PERSONS INJURED": datasets.Value("string"),
|
| 20 |
+
"NUMBER OF PERSONS KILLED": datasets.Value("string"),
|
| 21 |
+
"NUMBER OF PEDESTRIANS INJURED": datasets.Value("string"),
|
| 22 |
+
"NUMBER OF PEDESTRIANS KILLED": datasets.Value("string"),
|
| 23 |
+
"NUMBER OF CYCLIST INJURED": datasets.Value("string"),
|
| 24 |
+
"NUMBER OF CYCLIST KILLED": datasets.Value("string"),
|
| 25 |
+
"NUMBER OF MOTORIST INJURED": datasets.Value("string"),
|
| 26 |
+
"NUMBER OF MOTORIST KILLED": datasets.Value("string"),
|
| 27 |
+
"CONTRIBUTING FACTOR VEHICLE 1": datasets.Value("string"),
|
| 28 |
+
"CONTRIBUTING FACTOR VEHICLE 2": datasets.Value("string"),
|
| 29 |
+
"CONTRIBUTING FACTOR VEHICLE 3": datasets.Value("string"),
|
| 30 |
+
"CONTRIBUTING FACTOR VEHICLE 4": datasets.Value("string"),
|
| 31 |
+
"CONTRIBUTING FACTOR VEHICLE 5": datasets.Value("string"),
|
| 32 |
+
"COLLISION_ID": datasets.Value("string"),
|
| 33 |
+
"VEHICLE TYPE CODE 1": datasets.Value("string"),
|
| 34 |
+
"VEHICLE TYPE CODE 2": datasets.Value("string"),
|
| 35 |
+
"VEHICLE TYPE CODE 3": datasets.Value("string"),
|
| 36 |
+
"VEHICLE TYPE CODE 4": datasets.Value("string"),
|
| 37 |
+
"VEHICLE TYPE CODE 5": datasets.Value("string")
|
| 38 |
+
}),
|
| 39 |
+
supervised_keys=None,
|
| 40 |
+
)
|
| 41 |
+
|
| 42 |
+
def _split_generators(self, dl_manager):
|
| 43 |
+
data_path = dl_manager.download_and_extract("NYC_Motor_Vehicle_Collisions_Mar_12_2025.csv")
|
| 44 |
+
return [
|
| 45 |
+
datasets.SplitGenerator(name=datasets.Split.TRAIN, gen_kwargs={"filepath": data_path})
|
| 46 |
+
]
|
| 47 |
+
|
| 48 |
+
def _generate_examples(self, filepath):
|
| 49 |
+
with open(filepath, newline="", encoding="utf-8") as f:
|
| 50 |
+
reader = csv.DictReader(f)
|
| 51 |
+
for i, row in enumerate(reader):
|
| 52 |
+
yield i, row
|