Skip to content

Commit

Permalink
initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
John Templon committed Jun 4, 2020
0 parents commit a7de9df
Show file tree
Hide file tree
Showing 10 changed files with 144,016 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.ipynb_checkpoints
15 changes: 15 additions & 0 deletions Pipfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
[[source]]
name = "pypi"
url = "https://pypi.org/simple"
verify_ssl = true

[dev-packages]

[packages]
jupyter = "*"
pandas = "*"
matplotlib = "*"
xlrd = "*"

[requires]
python_version = "3.8"
529 changes: 529 additions & 0 deletions Pipfile.lock

Large diffs are not rendered by default.

34 changes: 34 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# "1033" Program Transfers Since Ferguson

This repository analyzes the transfers made by the Defense Logistics Agency to local law enforcement since the protests in Ferguson, Missouri in August 2014 in support of a BuzzFeed News story, published on June 4, 2020. See below for details.

The DLA is a sub-agency of the Department of Defense; it provides equipment to local law enforcement agencies [through its Law Enforcement Support Office](https://www.dla.mil/DispositionServices/Offers/Reutilization/LawEnforcement/PublicInformation/). The program is commonly referred to as the ["1033" program](https://www.dla.mil/DispositionServices/Offers/Reutilization/LawEnforcement/ProgramFAQs.aspx) due to the statute that enabled it in 1997.

## Data

The data used in this analysis comes from the DLA's [LESO Public Information](https://www.dla.mil/DispositionServices/Offers/Reutilization/LawEnforcement/PublicInformation/) page. The [`data/all.xlsx`](data/all.xlsx) file contains all property transferred to participating agencies that was held by them as of March 31, 2020. It is updated quarterly.

## Notebooks

### Data Conversion

The [`convert-data-to-csv.ipynb`](notebooks/convert-data-to-csv.ipynb) notebook takes the Excel file the DLA produces, reads each of the 52 sheets, and combines them into a single CSV with all the available data. The resulting CSV file is output to [`outputs/dla-1033-transfers.csv`](outputs/dla-1033-transfers.csv).

### Analysis

The [`analyze-transfers.ipynb`](notebooks/analyze-transfers.ipynb) takes the CSV data and analyzes all transfers where the `Ship Date` is after August 25, 2014, which marked the end of the first wave of protests in Ferguson. It walks through a few different pieces of analysis, including:

- Loading the data
- Filtering for transfers post August 25, 2014
- Totaling the transfers
- Highlighting categories of items mentioned in the story

## Licensing

All code in this repository is available under the [MIT License](https://opensource.org/licenses/MIT). Files in the `output/` directory are available under the [Creative Commons Attribution 4.0 International (CC BY 4.0) license](https://creativecommons.org/licenses/by/4.0/).

## Contact

If you have any questions about this repository you can reach out to John Templon at [[email protected]]([email protected]).

Looking for more from BuzzFeed News? [Click here for a list of our open-sourced projects, data, and code](https://github.com/BuzzFeedNews/everything).
Binary file added data/all.xlsx
Binary file not shown.
1,710 changes: 1,710 additions & 0 deletions notebooks/analyze-transfers.ipynb

Large diffs are not rendered by default.

121 changes: 121 additions & 0 deletions notebooks/convert-data-to-csv.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Convert Excel to CSV\n",
"\n",
"This notebook takes the Excel data available on the Defense Logistics Agency's [website](https://www.dla.mil/DispositionServices/Offers/Reutilization/LawEnforcement/PublicInformation/) and converts it to a CSV for easier analysis."
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [],
"source": [
"import pandas as pd"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"xls = pd.read_excel('../data/all.xlsx', sheet_name = None)"
]
},
{
"cell_type": "code",
"execution_count": 3,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"['Alabama', 'Alaska', 'Arkansas', 'Arizona', 'California']"
]
},
"execution_count": 3,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"list(xls.keys())[:5]"
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [],
"source": [
"data = pd.concat(xls.values())"
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"(141068, 11)"
]
},
"execution_count": 5,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"data.shape"
]
},
{
"cell_type": "code",
"execution_count": 6,
"metadata": {},
"outputs": [],
"source": [
"data.to_csv(\"../outputs/dla-1033-transfers.csv\", index=None)"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"---\n",
"\n",
"---\n",
"\n",
"---"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.1"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Loading

0 comments on commit a7de9df

Please sign in to comment.