Motor Vehicle Fatalities And Miles And Associated Rates

JohnSnowLabs

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

Data Files

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

motor-vehicle-fatalities-and-miles-and-associated-rates_zip  

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

Read me

Import into your tool

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

install.packages("jsonlite")
library("jsonlite")

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

# access csv file by the index starting from 1
path_to_file = json_data$resources$path[1][1]
data <- read.csv(url(path_to_file))
print(data)

In order to work with Data Packages in Pandas you need to install the Frictionless Data data package library and the pandas extension:

pip install datapackage
pip install jsontableschema-pandas

To get the data run following code:

import datapackage

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

# to load Data Package into storage
storage = datapackage.push_datapackage(data_url, 'pandas')

# data frames available (corresponding to data files in original dataset)
storage.buckets

# you can access datasets inside storage, e.g. the first one:
storage[storage.buckets[0]]

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('http://datahub.io/JohnSnowLabs/motor-vehicle-fatalities-and-miles-and-associated-rates/datapackage.json')

# get list of resources:
resources = package.descriptor['resources']
resourceList = [resources[x]['name'] for x in range(0, len(resources))]
print(resourceList)

data = package.resources[0].read()
print(data)

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 = 'http://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 the first data file in this dataset
  const file = dataset.resources[0]
  // Get a raw stream
  const stream = await file.stream()
  // entire file as a buffer (be careful with large files!)
  const buffer = await file.buffer
})()

Install the datapackage library created specially for Ruby language using gem:

gem install datapackage

Now get the dataset and read the data:

require 'datapackage'

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

package = DataPackage::Package.new(path)
# So package variable contains metadata. You can see it:
puts package

# Read data itself:
resource = package.resources[0]
data = resource.read
puts data
Datapackage.json