In [94]:
from pandas import DataFrame
import pandas as pd
data = DataFrame.from_csv('static/data/national_prisoner_statistics_1978_2014.tsv', sep='\t')
In [95]:
data['YEAR'] = data.index.year
data.reset_index(drop=True, inplace=True)
In [96]:
data['JURTOTT'] = data['JURTOTM'] + data['JURTOTF']
In [97]:
# chloropleth map of total under jurisdiction by state by year
# total under jurisdiction nationally by year
# total under jurisdiction nationally by race by year
# total under jurisdiction nationally by sex by year
In [98]:
output = data[['YEAR', 'STATE', 'JURTOTT', 'JURTOTM', 'JURTOTF']]
In [99]:
output = output.rename(columns={ 'YEAR': 'year', 'STATE': 'state', 'JURTOTT': 'total', 'JURTOTM': 'male', 'JURTOTF': 'female' })
In [102]:
output.to_csv('static/data/total_prisoners_by_year_by_state.csv', index=False)