Motor Vehicle Fatalities And Miles And Associated Rates

JohnSnowLabs

Files Size Format Created Updated License Source
2 80kB csv zip 3 months ago John Snow Labs Standard License John Snow Labs Bureau of Transportation Statistics
Download

Data Files

File Description Size Last changed Download
motor-vehicle-fatalities-and-miles-and-associated-rates-csv 6kB csv (6kB) , json (39kB)
motor-vehicle-fatalities-and-miles-and-associated-rates_zip Compressed versions of dataset. Includes normalized CSV and JSON data with original data and datapackage.json. 12kB zip (12kB)

motor-vehicle-fatalities-and-miles-and-associated-rates-csv  

This is a preview version. There might be more data in the original version.

Field information

Field Name Order Type (Format) Description
Year 1 integer Year of data
Rural_Total_Fatalities 2 integer Number of rural road fatalities. Fatalities data reflect original numbers received by the Federal Highway Administration (FHWA) from the National Highway Traffic Safety Administration (NHTSA). Thus, the Fatalities data in this table could be slightly different from the revised NHTSA numbers that appear in other tables in this volume. Includes the 50 states and the District of Columbia.
Rural_Interstate_Fatalities 3 integer Number of rural interstate road fatalities
Rural_Other_Arterials_Fatalities 4 integer Number of fatalities in rural other arterial road fatalities. Rural Other arterials for 2015 are the sum of other freeways and expressways, other principal arterials, and minor arterials. Rural Other arterials for all other years are the sum of other principal arterials and minor arterials.
Rural_Collector_Fatalities 5 integer Number of fatalities in rural collector roads. Collector is the sum of major and minor collectors.
Rural_Local_Fatalities 6 integer Number of fatalities in rural local roads
Urban_Total_Fatalities 7 integer Total number of fatalities in urban roads. Fatalities data reflect original numbers received by the Federal Highway Administration (FHWA) from the National Highway Traffic Safety Administration (NHTSA). Thus, the Fatalities data in this table could be slightly different from the revised NHTSA numbers that appear in other tables in this volume. Includes the 50 states and the District of Columbia.
Urban_Interstate_Fatalities 8 integer Number of fatalities in urban interstate roads
Urban_Other_Arterials_Fatalities 9 integer Number of fatalities in urban other arterial roads. Urban Other arterials for all years and Rural Other arterials for 2015 are the sum of other freeways and expressways, other principal arterials, and minor arterials. Rural Other arterials for all other years are the sum of other principal arterials and minor arterials.
Urban_Collector_Fatalities 10 integer Number of fatalities in urban collector roads. Collector is the sum of major and minor collectors.
Urban_Local_Fatalities 11 integer Number of fatalities in urban local roads
Rural_Total_Vehicle_Miles_Of_Travel_In_Millions 12 integer Rural road distance of vehicle travel in million miles
Rural_Interstate_Vehicle_Miles_Of_Travel_In_Millions 13 integer Rural interstate road distance of vehicle travel in million miles
Rural_Other_Arterials_Vehicle_Miles_Of_Travel_In_Millions 14 integer Rural other arterial road distance of vehicle travel in million miles. Urban Other arterials for all years and Rural Other arterials for 2015 are the sum of other freeways and expressways, other principal arterials, and minor arterials. Rural Other arterials for all other years are the sum of other principal arterials and minor arterials.
Rural_Collector_Vehicle_Miles_Of_Travel_Millions 15 integer Rural collector road distance of vehicle travel in million miles. Collector is the sum of major and minor collectors.
Rural_Local_Vehicle_Miles_Of_Travel_Millions 16 integer Rural local road distance of vehicle travel in million miles
Urban_Total_Vehicle_Miles_Of_Travel_Millions 17 integer Urban road distance of vehicle travel in million miles
Urban_Interstate_Vehicle_Miles_Of_Travel_Millions 18 integer Urban interstate road distance of vehicle travel in million miles
Urban_Other_Arterials_Vehicle_Miles_Of_Travel_Millions 19 integer Urban other arterial road distance of vehicle travel in million miles. Urban Other arterials for all years and Rural Other arterials for 2015 are the sum of other freeways and expressways, other principal arterials, and minor arterials. Rural Other arterials for all other years are the sum of other principal arterials and minor arterials.
Urban_Collector_Vehicle_Miles_Of_Travel_Millions 20 integer Urban collector road distance of vehicle travel in million miles. Collector is the sum of major and minor collectors.
Urban_Local_Vehicle_Miles_Of_Travel_Millions 21 integer Urban local road distance of vehicle travel in million miles
Rural_Total_Fatality_Rates_Per_100_Million_Vehicle_Miles 22 number Rural road fatality rate
Rural_Interstate_Fatality_Rates_Per_100_Million_Vehicle_Miles 23 number Rural interstate road fatality rate
Rural_Other_Arterials_Fatality_Rates_Per_100_Million_Vehicle_Miles 24 number Rural other arterial road fatality rate
Rural_Collector_Fatality_Rates_Per_100_Million_Vehicle_Miles 25 number Rural collector road fatality rate
Rural_Local_Fatality_Rates_Per_100_Million_Vehicle_Miles 26 number Rural local road fatality rate
Urban_Total_Fatality_Rates_Per_100_Million_Vehicle_Miles 27 number Urban road fatality rate
Urban_Interstate_Fatality_Rates_Per_100_Million_Vehicle_Miles 28 number Urban interstate road fatality rate
Urban_Other_Arterials_Fatality_Rates_Per_100_Million_Vehicle_Miles 29 number Urban other arterial road fatality rate
Urban_Collector_Fatality_Rates_Per_100_Million_Vehicle_Miles 30 number Urban collector road fatality rate
Urban_Local_Fatality_Rates_Per_100_Million_Vehicle_Miles 31 number Urban local road fatality rate

Import into your tool

Data-cli or just data is the program to get and post your data with the datahub.
Use data with the datahub.io almost like you use git with the github. Here are installation instructions.

data get https://datahub.io/JohnSnowLabs/motor-vehicle-fatalities-and-miles-and-associated-rates
tree JohnSnowLabs/motor-vehicle-fatalities-and-miles-and-associated-rates
# Get a list of dataset's resources
curl -L -s https://datahub.io/JohnSnowLabs/motor-vehicle-fatalities-and-miles-and-associated-rates/datapackage.json | grep path

# Get resources

curl -L https://datahub.io/JohnSnowLabs/motor-vehicle-fatalities-and-miles-and-associated-rates/r/0.csv

curl -L https://datahub.io/JohnSnowLabs/motor-vehicle-fatalities-and-miles-and-associated-rates/r/1.zip

If you are using R here's how to get the data you want quickly loaded:

install.packages("jsonlite", repos="https://cran.rstudio.com/")
library("jsonlite")

json_file <- 'https://datahub.io/JohnSnowLabs/motor-vehicle-fatalities-and-miles-and-associated-rates/datapackage.json'
json_data <- fromJSON(paste(readLines(json_file), collapse=""))

# get list of all resources:
print(json_data$resources$name)

# print all tabular data(if exists any)
for(i in 1:length(json_data$resources$datahub$type)){
  if(json_data$resources$datahub$type[i]=='derived/csv'){
    path_to_file = json_data$resources$path[i]
    data <- read.csv(url(path_to_file))
    print(data)
  }
}

Note: You might need to run the script with root permissions if you are running on Linux machine

Install the Frictionless Data data package library and the pandas itself:

pip install datapackage
pip install pandas

Now you can use the datapackage in the Pandas:

import datapackage
import pandas as pd

data_url = 'https://datahub.io/JohnSnowLabs/motor-vehicle-fatalities-and-miles-and-associated-rates/datapackage.json'

# to load Data Package into storage
package = datapackage.Package(data_url)

# to load only tabular data
resources = package.resources
for resource in resources:
    if resource.tabular:
        data = pd.read_csv(resource.descriptor['path'])
        print (data)

For Python, first install the `datapackage` library (all the datasets on DataHub are Data Packages):

pip install datapackage

To get Data Package into your Python environment, run following code:

from datapackage import Package

package = Package('https://datahub.io/JohnSnowLabs/motor-vehicle-fatalities-and-miles-and-associated-rates/datapackage.json')

# print list of all resources:
print(package.resource_names)

# print processed tabular data (if exists any)
for resource in package.resources:
    if resource.descriptor['datahub']['type'] == 'derived/csv':
        print(resource.read())

If you are using JavaScript, please, follow instructions below:

Install data.js module using npm:

  $ npm install data.js

Once the package is installed, use the following code snippet:

const {Dataset} = require('data.js')

const path = 'https://datahub.io/JohnSnowLabs/motor-vehicle-fatalities-and-miles-and-associated-rates/datapackage.json'

// We're using self-invoking function here as we want to use async-await syntax:
;(async () => {
  const dataset = await Dataset.load(path)
  // get list of all resources:
  for (const id in dataset.resources) {
    console.log(dataset.resources[id]._descriptor.name)
  }
  // get all tabular data(if exists any)
  for (const id in dataset.resources) {
    if (dataset.resources[id]._descriptor.format === "csv") {
      const file = dataset.resources[id]
      // Get a raw stream
      const stream = await file.stream()
      // entire file as a buffer (be careful with large files!)
      const buffer = await file.buffer
      // print data
      stream.pipe(process.stdout)
    }
  }
})()
Datapackage.json