FBI Crime Data API

The FBI Crime Data API is a read-only web service that returns JSON or CSV data. It is broadly organized around the FBI’s Uniform Crime Reporting systems data, and requires a data.gov API network key. Agencies submit data using one of two reporting formats – the Summary Reporting System (SRS), or the National Incident Based Reporting System (NIBRS).

The FBI also provides full documentation and source code.

import requests
import pandas as pd
base = 'https://api.usa.gov/crime/fbi/sapi/'
query = 'api/summarized/agencies/WY0200100/homicide?api_key='
key = 'your_api_key' 

# Homicides Recorded by Jackson Police Department
response = requests.get(base + query + key)
data = response.json()
df = pd.DataFrame(data['results'])

library(jsonlite)
url <- paste("https://api.usa.gov/crime/fbi/sapi/"
            , "api/summarized/agencies/WY0200100/homicide?api_key="
            , "your_api_key" 
            , sep = "")

data <- fromJSON(url)
df <- data[["results"]]


National Study of Private Ownership of Firearms in the United States, 1994

This data collection consists of a survey of private ownership of firearms by adults in the United States. Respondents who both did and did not own firearms were included. The variables cover topics such as the number and type of guns owned privately, methods of, and reasons for, firearms acquisition, the storage and carrying of guns, the defensive use of firearms against criminal attackers, and reasons for and against firearm ownership. Basic demographic variables include sex, age, education, and employment.

The full codebook can be viewed here.

The public-use data files in this collection are available for access by the general public. Access does not require affiliation with an ICPSR member institution. However, an ICPSR login is still required to download the data itself.

import pandas as pd
# Download Variables of interest from data portal
# You can load the data file like any text file
df = pd.read_table('default.dat')

# Download Variables of interest from data portal
# You can load the data file like any text file
df <- pd.read_table("default.dat")