In [1]:
import pandas as pd
import matplotlib.pyplot as plt
%matplotlib inline

In [2]:
#2007 Data
xls_file = pd.ExcelFile('FBI By State/state/07tbl69.xls')
df = xls_file.parse('TABLE69k')
df.columns =['State', 'Age', 'Total all classes', 'Violent crime', 'Property crime','Murder', 'Forcible rape', 
             'Robbery', 'Aggravated assault', 'Burglary', 'Larceny-theft', 'Motor vehicle theft', 'Arson',
            'Other assaults', 'Forgery and counterfeiting', 'Fraud', 'Embezzlement', 'Stolen property; buying, receiving, possessing',
            'Vandalism', 'Weapons; carring, possessing', 'Prostitution and commercialized vice', 'Sex offences', 
             'Drug abuse violations',
            'Gambling', 'Offenses against the family and children', 'Driving under the influence', 'Liquor laws', 'Drunkenness', 
            'Disorderly conduct', 'Vagrancy', 'All other offenses', 'Suspicion', 'Curfew and loitering law violations', 'Runaways',
            'Number of agencies', 'Estimated population']
df = df[3:]
df = df[['State', 'Age', 'Forgery and counterfeiting', 'Fraud', 'Stolen property; buying, receiving, possessing',
        'Weapons; carring, possessing','Drug abuse violations','Gambling']]
df2007 = df[:-8]
count = 2
state = ""
for each in df2007.State:
    count = count + 1
    if(count % 2 == 1):
        state = each
    if(count % 2 == 0):
        df2007.set_value(count, 'State', state)


df2007 = df2007.iloc[1::2]
#df2007.to_csv('2007FBI', sep='\t', encoding='utf-8')

In [3]:
#2008 data
xls_file = pd.ExcelFile('FBI By State/state/08tbl69.xls')
df = xls_file.parse('08tbl69')
df.columns =['State', 'Age', 'Total all classes', 'Violent crime', 'Property crime','Murder', 'Forcible rape', 
             'Robbery', 'Aggravated assault', 'Burglary', 'Larceny-theft', 'Motor vehicle theft', 'Arson',
            'Other assaults', 'Forgery and counterfeiting', 'Fraud', 'Embezzlement', 'Stolen property; buying, receiving, possessing',
            'Vandalism', 'Weapons; carring, possessing', 'Prostitution and commercialized vice', 'Sex offences', 
             'Drug abuse violations',
            'Gambling', 'Offenses against the family and children', 'Driving under the influence', 'Liquor laws', 'Drunkenness', 
            'Disorderly conduct', 'Vagrancy', 'All other offenses', 'Suspicion', 'Curfew and loitering law violations', 'Runaways',
            'Number of agencies', 'Estimated population']
df = df[3:]
df = df[['State', 'Age', 'Forgery and counterfeiting', 'Fraud', 'Stolen property; buying, receiving, possessing',
        'Weapons; carring, possessing','Drug abuse violations','Gambling']]
df2008 = df[:-14]
count = 2
state = ""
for each in df2008.State:
    count = count + 1
    if(count % 2 == 1):
        state = each
    if(count % 2 == 0):
        df2008.set_value(count, 'State', state)


df2008 = df2008.iloc[1::2]
#df2008.to_csv('2008FBI', sep='\t', encoding='utf-8')

In [4]:
#2009 Data
xls_file = pd.ExcelFile('FBI By State/state/09tbl69.xls')
df = xls_file.parse('09tbl69')
df.columns =['State', 'Age', 'Total all classes', 'Violent crime', 'Property crime','Murder', 'Forcible rape', 
             'Robbery', 'Aggravated assault', 'Burglary', 'Larceny-theft', 'Motor vehicle theft', 'Arson',
            'Other assaults', 'Forgery and counterfeiting', 'Fraud', 'Embezzlement', 'Stolen property; buying, receiving, possessing',
            'Vandalism', 'Weapons; carring, possessing', 'Prostitution and commercialized vice', 'Sex offences', 
             'Drug abuse violations',
            'Gambling', 'Offenses against the family and children', 'Driving under the influence', 'Liquor laws', 'Drunkenness', 
            'Disorderly conduct', 'Vagrancy', 'All other offenses', 'Suspicion', 'Curfew and loitering law violations', 'Runaways',
            'Number of agencies', 'Estimated population']
df = df[3:]
df = df[['State', 'Age', 'Forgery and counterfeiting', 'Fraud', 'Stolen property; buying, receiving, possessing',
        'Weapons; carring, possessing','Drug abuse violations','Gambling']]
df2009 = df[:-8]
count = 2
state = ""
for each in df2009.State:
    count = count + 1
    if(count % 2 == 1):
        state = each
    if(count % 2 == 0):
        df2009.set_value(count, 'State', state)


df2009 = df2009.iloc[1::2]

In [5]:
#2010 Data
xls_file = pd.ExcelFile('FBI By State/state/10tbl69.xls')
df = xls_file.parse('10tbl69')
df.columns =['State', 'Age', 'Total all classes', 'Violent crime', 'Property crime','Murder', 'Forcible rape', 
             'Robbery', 'Aggravated assault', 'Burglary', 'Larceny-theft', 'Motor vehicle theft', 'Arson',
            'Other assaults', 'Forgery and counterfeiting', 'Fraud', 'Embezzlement', 'Stolen property; buying, receiving, possessing',
            'Vandalism', 'Weapons; carring, possessing', 'Prostitution and commercialized vice', 'Sex offences', 
             'Drug abuse violations',
            'Gambling', 'Offenses against the family and children', 'Driving under the influence', 'Liquor laws', 'Drunkenness', 
            'Disorderly conduct', 'Vagrancy', 'All other offenses', 'Suspicion', 'Curfew and loitering law violations',
            'Number of agencies', 'Estimated population']
df = df[3:]
df = df[['State', 'Age', 'Forgery and counterfeiting', 'Fraud', 'Stolen property; buying, receiving, possessing',
        'Weapons; carring, possessing','Drug abuse violations','Gambling']]
df2010 = df[:-8]
count = 2
state = ""
for each in df2010.State:
    count = count + 1
    if(count % 2 == 1):
        state = each
    if(count % 2 == 0):
        df2010.set_value(count, 'State', state)


df2010 = df2010.iloc[1::2]

In [6]:
#2011 Data
xls_file = pd.ExcelFile('FBI By State/state/table_69_arrest_by_state_2011.xls')
df = xls_file.parse('11tbl69')
df.columns =['State', 'Age', 'Total all classes', 'Violent crime', 'Property crime','Murder', 'Forcible rape', 
             'Robbery', 'Aggravated assault', 'Burglary', 'Larceny-theft', 'Motor vehicle theft', 'Arson',
            'Other assaults', 'Forgery and counterfeiting', 'Fraud', 'Embezzlement', 'Stolen property; buying, receiving, possessing',
            'Vandalism', 'Weapons; carring, possessing', 'Prostitution and commercialized vice', 'Sex offences', 
             'Drug abuse violations',
            'Gambling', 'Offenses against the family and children', 'Driving under the influence', 'Liquor laws', 'Drunkenness', 
            'Disorderly conduct', 'Vagrancy', 'All other offenses', 'Suspicion', 'Curfew and loitering law violations',
            'Number of agencies', 'Estimated population']
df = df[3:]
df = df[['State', 'Age', 'Forgery and counterfeiting', 'Fraud', 'Stolen property; buying, receiving, possessing',
        'Weapons; carring, possessing','Drug abuse violations','Gambling']]
df2011 = df[:-8]
count = 2
state = ""
for each in df2011.State:
    count = count + 1
    if(count % 2 == 1):
        state = each
    if(count % 2 == 0):
        df2011.set_value(count, 'State', state)


df2011 = df2011.iloc[1::2]

In [7]:
#2012 Data
xls_file = pd.ExcelFile('FBI By State/state/table_69_arrest_by_state_2012.xls')
df = xls_file.parse('12tbl69')
df.columns =['State', 'Age', 'Total all classes', 'Violent crime', 'Property crime','Murder', 'Forcible rape', 
             'Robbery', 'Aggravated assault', 'Burglary', 'Larceny-theft', 'Motor vehicle theft', 'Arson',
            'Other assaults', 'Forgery and counterfeiting', 'Fraud', 'Embezzlement', 'Stolen property; buying, receiving, possessing',
            'Vandalism', 'Weapons; carring, possessing', 'Prostitution and commercialized vice', 'Sex offences', 
             'Drug abuse violations',
            'Gambling', 'Offenses against the family and children', 'Driving under the influence', 'Liquor laws', 'Drunkenness', 
            'Disorderly conduct', 'Vagrancy', 'All other offenses', 'Suspicion', 'Curfew and loitering law violations',
            'Number of agencies', 'Estimated population']
df = df[3:]
df = df[['State', 'Age', 'Forgery and counterfeiting', 'Fraud', 'Stolen property; buying, receiving, possessing',
        'Weapons; carring, possessing','Drug abuse violations','Gambling']]
df2012 = df[:-9]
count = 2
state = ""
for each in df2012.State:
    count = count + 1
    if(count % 2 == 1):
        state = each
    if(count % 2 == 0):
        df2012.set_value(count, 'State', state)


df2012 = df2012.iloc[1::2]

In [8]:
#2013 Data
xls_file = pd.ExcelFile('FBI By State/state/table_69_arrest_by_state_2013.xls')
df = xls_file.parse('13tbl69')
df.columns =['State', 'Age', 'Total all classes', 'Violent crime', 'Property crime','Murder', 'Forcible rape', 
             'Robbery', 'Aggravated assault', 'Burglary', 'Larceny-theft', 'Motor vehicle theft', 'Arson',
            'Other assaults', 'Forgery and counterfeiting', 'Fraud', 'Embezzlement', 'Stolen property; buying, receiving, possessing',
            'Vandalism', 'Weapons; carring, possessing', 'Prostitution and commercialized vice', 'Sex offences', 
             'Drug abuse violations',
            'Gambling', 'Offenses against the family and children', 'Driving under the influence', 'Liquor laws', 'Drunkenness', 
            'Disorderly conduct', 'Vagrancy', 'All other offenses', 'Suspicion', 'Curfew and loitering law violations',
            'Number of agencies', 'Estimated population']
df = df[3:]
df = df[['State', 'Age', 'Forgery and counterfeiting', 'Fraud', 'Stolen property; buying, receiving, possessing',
        'Weapons; carring, possessing','Drug abuse violations','Gambling']]
df2013 = df[:-9]
count = 2
state = ""
for each in df2013.State:
    count = count + 1
    if(count % 2 == 1):
        state = each
    if(count % 2 == 0):
        df2013.set_value(count, 'State', state)


df2013 = df2013.iloc[1::2]

In [9]:
#2014 Data
xls_file = pd.ExcelFile('FBI By State/state/table_69_arrest_by_state_2014.xls')
df = xls_file.parse('14tbl69')
df.columns =['State', 'Age', 'Total all classes', 'Violent crime', 'Property crime','Murder', 'Forcible rape', 
             'Robbery', 'Aggravated assault', 'Burglary', 'Larceny-theft', 'Motor vehicle theft', 'Arson',
            'Other assaults', 'Forgery and counterfeiting', 'Fraud', 'Embezzlement', 'Stolen property; buying, receiving, possessing',
            'Vandalism', 'Weapons; carring, possessing', 'Prostitution and commercialized vice', 'Sex offences', 
             'Drug abuse violations',
            'Gambling', 'Offenses against the family and children', 'Driving under the influence', 'Liquor laws', 'Drunkenness', 
            'Disorderly conduct', 'Vagrancy', 'All other offenses', 'Suspicion', 'Curfew and loitering law violations',
            'Number of agencies', 'Estimated population']
df = df[3:]
df = df[['State', 'Age', 'Forgery and counterfeiting', 'Fraud', 'Stolen property; buying, receiving, possessing',
        'Weapons; carring, possessing','Drug abuse violations','Gambling']]
df2014 = df[:-16]
count = 2
state = ""
for each in df2014.State:
    count = count + 1
    if(count % 2 == 1):
        state = each
    if(count % 2 == 0):
        df2014.set_value(count, 'State', state)


df2014 = df2014.iloc[1::2]

In [10]:
#2015 Data
xls_file = pd.ExcelFile('FBI By State/state/table_69_arrest_by_state_2015.xls')
df = xls_file.parse('15tbl69')
df.columns =['State', 'Age', 'Total all classes', 'Violent crime', 'Property crime','Murder', 'Forcible rape', 
             'Robbery', 'Aggravated assault', 'Burglary', 'Larceny-theft', 'Motor vehicle theft', 'Arson',
            'Other assaults', 'Forgery and counterfeiting', 'Fraud', 'Embezzlement', 'Stolen property; buying, receiving, possessing',
            'Vandalism', 'Weapons; carring, possessing', 'Prostitution and commercialized vice', 'Sex offences', 
             'Drug abuse violations',
            'Gambling', 'Offenses against the family and children', 'Driving under the influence', 'Liquor laws', 'Drunkenness', 
            'Disorderly conduct', 'Vagrancy', 'All other offenses', 'Suspicion', 'Curfew and loitering law violations',
            'Number of agencies', 'Estimated population']
df = df[3:]
df = df[['State', 'Age', 'Forgery and counterfeiting', 'Fraud', 'Stolen property; buying, receiving, possessing',
        'Weapons; carring, possessing','Drug abuse violations','Gambling']]
df2015 = df[:-9]
count = 2
state = ""
for each in df2015.State:
    count = count + 1
    if(count % 2 == 1):
        state = each
    if(count % 2 == 0):
        df2015.set_value(count, 'State', state)


df2015 = df2015.iloc[1::2]

In [11]:
# Forgery Data
dataForgery = {'State': df2007['State'], 
        '2007': df2007['Forgery and counterfeiting'], 
        '2008': df2008['Forgery and counterfeiting'],
        '2009': df2009['Forgery and counterfeiting'], 
        '2010': df2010['Forgery and counterfeiting'], 
        '2011': df2011['Forgery and counterfeiting'], 
        '2012': df2012['Forgery and counterfeiting'], 
        '2013': df2013['Forgery and counterfeiting'], 
        '2014': df2014['Forgery and counterfeiting'], 
        '2015': df2015['Forgery and counterfeiting']}
dfForgery = pd.DataFrame(dataForgery)
dfForgery = dfForgery.set_index('State')
dfForgery['mean'] = dfForgery[['2007', '2008', '2009', '2010', '2011', '2012', '2013', '2014', '2015']].mean(axis=1)
dfForgerySort = dfForgery.sort_values(by='mean', ascending=False)

In [12]:
dataFraud = {'State': df2007['State'], 
        '2007': df2007['Fraud'], 
        '2008': df2008['Fraud'],
        '2009': df2009['Fraud'], 
        '2010': df2010['Fraud'], 
        '2011': df2011['Fraud'], 
        '2012': df2012['Fraud'], 
        '2013': df2013['Fraud'], 
        '2014': df2014['Fraud'], 
        '2015': df2015['Fraud']}
dfFraud = pd.DataFrame(dataFraud)
dfFraud = dfFraud.set_index('State')
dfFraud['mean'] = dfFraud[['2007', '2008', '2009', '2010', '2011', '2012', '2013', '2014', '2015']].mean(axis=1)
dfFraudSort = dfFraud.sort_values(by='mean', ascending=False)

In [13]:
dataStolen = {'State': df2007['State'], 
        '2007': df2007['Stolen property; buying, receiving, possessing'], 
        '2008': df2008['Stolen property; buying, receiving, possessing'],
        '2009': df2009['Stolen property; buying, receiving, possessing'], 
        '2010': df2010['Stolen property; buying, receiving, possessing'], 
        '2011': df2011['Stolen property; buying, receiving, possessing'], 
        '2012': df2012['Stolen property; buying, receiving, possessing'], 
        '2013': df2013['Stolen property; buying, receiving, possessing'], 
        '2014': df2014['Stolen property; buying, receiving, possessing'], 
        '2015': df2015['Stolen property; buying, receiving, possessing']}
dfStolen = pd.DataFrame(dataStolen)
dfStolen = dfStolen.set_index('State')
dfStolen['mean'] = dfStolen[['2007', '2008', '2009', '2010', '2011', '2012', '2013', '2014', '2015']].mean(axis=1)
dfStolenSort = dfStolen.sort_values(by='mean', ascending=False)

In [14]:
dataWeapons = {'State': df2007['State'], 
        '2007': df2007['Weapons; carring, possessing'], 
        '2008': df2008['Weapons; carring, possessing'],
        '2009': df2009['Weapons; carring, possessing'], 
        '2010': df2010['Weapons; carring, possessing'], 
        '2011': df2011['Weapons; carring, possessing'], 
        '2012': df2012['Weapons; carring, possessing'], 
        '2013': df2013['Weapons; carring, possessing'], 
        '2014': df2014['Weapons; carring, possessing'], 
        '2015': df2015['Weapons; carring, possessing']}
dfWeapons = pd.DataFrame(dataWeapons)
dfWeapons = dfWeapons.set_index('State')
dfWeapons['mean'] = dfWeapons[['2007', '2008', '2009', '2010', '2011', '2012', '2013', '2014', '2015']].mean(axis=1)
dfWeaponsSort = dfWeapons.sort_values(by='mean', ascending=False)

In [30]:
dataDrug = {'State': df2007['State'], 
        '2007': df2007['Drug abuse violations'], 
        '2008': df2008['Drug abuse violations'],
        '2009': df2009['Drug abuse violations'], 
        '2010': df2010['Drug abuse violations'], 
        '2011': df2011['Drug abuse violations'], 
        '2012': df2012['Drug abuse violations'], 
        '2013': df2013['Drug abuse violations'], 
        '2014': df2014['Drug abuse violations'], 
        '2015': df2015['Drug abuse violations']}
dfDrug = pd.DataFrame(dataDrug)
dfDrug = dfDrug.set_index('State')
dfDrug['mean'] = dfDrug[['2007', '2008', '2009', '2010', '2011', '2012', '2013', '2014', '2015']].mean(axis=1)
dfDrugSort = dfDrug.sort_values(by='mean', ascending=False)
dfDrug


Out[30]:
2007 2008 2009 2010 2011 2012 2013 2014 2015 mean
State
ALABAMA 17309 16488 15180 8213 300 306 325 220 8967 7478.666667
ALASKA 1759 1716 2050 2491 2341 1547 1475 1159 1212 1750.000000
ARIZONA 35384 34242 35087 30349 30886 27273 30962 29670 24892 30971.666667
ARKANSAS 9953 11513 11213 9753 8783 11083 11391 11168 12700 10839.666667
CALIFORNIA 289449 268763 251740 241547 188188 194290 217520 229083 206194 231863.777778
COLORADO4 18290 17851 16658 15294 15109 15953 12370 13381 14430 15481.777778
CONNECTICUT 14663 16132 17757 17092 13667 9651 9137 9927 7635 12851.222222
DELAWARE 5744 5895 5752 5395 5110 5463 6250 6163 5734 5722.888889
DISTRICT OF COLUMBIA4, 5 77 79 121 0 204 0 323 389 232 158.333333
FLORIDA4, 6 169360 159916 146056 141831 130296 127919 126137 122190 114988 137632.555556
GEORGIA 44019 34697 39395 41312 42812 42889 44539 42619 34837 40791.000000
HAWAII 0 2022 2055 2078 0 892 1087 1122 2160 1268.444444
IDAHO 5660 5514 5751 6349 6558 6848 7591 7409 6541 6469.000000
ILLINOIS 55125 45612 43536 42934 38701 35715 35001 29478 24101 38911.444444
INDIANA 22753 22671 23203 16728 23345 18372 12470 16167 16526 19137.222222
IOWA 8825 8497 8376 9031 9139 8666 9182 9115 8114 8771.666667
KANSAS 7089 6854 6316 8122 7364 7629 8130 7677 7756 7437.444444
KENTUCKY 11883 7952 18553 18277 21383 21141 21830 21644 22106 18307.666667
LOUISIANA 22964 17959 19334 19324 14925 15748 20727 17693 17686 18484.444444
MAINE 5721 5778 5897 5933 5627 5544 5608 5802 5947 5761.888889
MARYLAND 55155 57288 51629 44888 41022 39733 34006 37780 26154 43072.777778
MASSACHUSETTS 20626 19825 12127 12086 10849 11599 11206 10516 9761 13177.222222
MICHIGAN 33923 31775 34910 34513 31486 31823 34128 33567 34716 33426.777778
MINNESOTA7 18814 18196 17040 17501 17727 15087 19056 19148 17342 17767.888889
MISSISSIPPI 10289 11741 13240 11004 10862 10678 8037 8958 9010 10424.333333
MISSOURI 32958 35990 35321 33964 35383 34943 35131 33496 34052 34582.000000
MONTANA 1566 1620 1539 1494 1790 2077 1958 2205 1961 1801.111111
NEBRASKA 9816 10432 9731 10177 10423 10433 10366 11965 8589 10214.666667
NEVADA 14444 14886 16976 16268 15562 15001 11207 12508 11594 14271.777778
NEW HAMPSHIRE 2570 3266 4020 3915 3631 3941 4270 6224 7371 4356.444444
NEW JERSEY 52773 52749 52461 49072 46377 51111 50775 52721 46376 50490.555556
NEW MEXICO 6805 6113 6478 8814 8859 8044 4773 5529 7188 6955.888889
NEW YORK4 61163 52945 60543 62519 56508 65840 61633 58782 62035 60218.666667
NORTH CAROLINA 38343 36571 33062 33170 42225 38240 35470 34695 21487 34807.000000
NORTH DAKOTA 1743 1769 1851 1938 2243 2446 3345 4004 4475 2646.000000
OHIO 34740 30580 30904 31465 28943 26936 28612 36331 32827 31259.777778
OKLAHOMA 22319 20548 20311 19714 15931 16688 16946 17721 17771 18661.000000
OREGON 18664 16723 15469 15600 19262 18929 10009 11165 11152 15219.222222
PENNSYLVANIA 57305 56228 52549 55858 52483 55610 54452 57392 52281 54906.444444
RHODE ISLAND 2933 3791 4081 3782 3111 3665 2240 1913 1757 3030.333333
SOUTH CAROLINA 30679 18224 27548 30435 26287 27174 28838 26720 25666 26841.222222
SOUTH DAKOTA 1371 2395 2868 2903 3694 4372 5382 5406 7058 3938.777778
TENNESSEE 38899 34686 35812 37512 40911 43448 46923 41493 38486 39796.666667
TEXAS 136361 136897 144329 136966 126695 133110 133711 135683 131851 135067.000000
UTAH 9239 9242 11224 10728 5207 12710 13377 14630 14913 11252.222222
VERMONT 1632 1137 1433 1156 1041 1390 1250 661 610 1145.555556
VIRGINIA 32941 32513 29780 33666 35416 38038 39536 36988 33558 34715.111111
WASHINGTON 28872 23440 16561 20644 12570 12706 11346 11111 11026 16475.111111
WEST VIRGINIA 3928 4249 6167 6235 6798 6647 6651 5994 6187 5872.888889
WISCONSIN 25746 25075 24446 22651 24140 26073 25582 24854 25302 24874.333333
WYOMING 3110 2969 2807 3103 3205 3036 3527 3459 3695 3212.333333

In [32]:
dataGamble = {'State': df2007['State'], 
        '2007': df2007['Gambling'], 
        '2008': df2008['Gambling'],
        '2009': df2009['Gambling'], 
        '2010': df2010['Gambling'], 
        '2011': df2011['Gambling'], 
        '2012': df2012['Gambling'], 
        '2013': df2013['Gambling'], 
        '2014': df2014['Gambling'], 
        '2015': df2015['Gambling']}
dfGamble = pd.DataFrame(dataGamble)
dfGamble = dfGamble.set_index('State')
dfGamble['mean'] = dfGamble[['2007', '2008', '2009', '2010', '2011', '2012', '2013', '2014', '2015']].mean(axis=1)
dfGambleSort = dfGamble.sort_values(by='mean', ascending=False)
dfGamble


Out[32]:
2007 2008 2009 2010 2011 2012 2013 2014 2015 mean
State
ALABAMA 57 58 120 47 0 0 0 0 0 31.333333
ALASKA 8 0 0 10 1 1 0 0 0 2.222222
ARIZONA 1 7 3 268 55 2 1 6 15 39.777778
ARKANSAS 3 24 34 10 18 21 39 8 1 17.555556
CALIFORNIA 689 615 658 497 590 460 389 285 255 493.111111
COLORADO4 8 7 11 4 2 0 3 13 1 5.444444
CONNECTICUT 25 37 73 31 61 71 14 14 12 37.555556
DELAWARE 2 6 15 12 6 3 3 6 0 5.888889
DISTRICT OF COLUMBIA4, 5 0 1 2 0 1 0 0 0 0 0.444444
FLORIDA4, 6 297 464 356 384 315 330 303 416 157 335.777778
GEORGIA 197 319 351 585 331 385 211 238 143 306.666667
HAWAII 0 31 19 38 0 34 70 53 43 32.000000
IDAHO 1 1 0 0 0 0 32 0 0 3.777778
ILLINOIS 4194 3604 3046 3059 2429 2467 2019 1356 914 2565.333333
INDIANA 155 38 36 18 61 18 74 14 13 47.444444
IOWA 12 13 6 8 6 6 4 5 6 7.333333
KANSAS 0 9 0 1 1 1 3 0 0 1.666667
KENTUCKY 8 11 28 15 7 19 15 9 15 14.111111
LOUISIANA 139 83 59 61 103 75 83 34 35 74.666667
MAINE 2 4 3 2 3 3 7 4 8 4.000000
MARYLAND 454 283 314 240 225 206 88 239 166 246.111111
MASSACHUSETTS 22 35 21 15 15 19 15 23 24 21.000000
MICHIGAN 159 136 154 118 93 45 71 55 72 100.333333
MINNESOTA7 12 14 19 19 22 15 33 28 29 21.222222
MISSISSIPPI 382 227 163 126 200 172 81 72 95 168.666667
MISSOURI 110 125 101 99 109 21 192 116 73 105.111111
MONTANA 0 0 0 0 0 0 0 0 2 0.222222
NEBRASKA 11 19 19 10 4 8 6 6 0 9.222222
NEVADA 98 35 33 19 31 52 10 50 35 40.333333
NEW HAMPSHIRE 24 5 3 5 2 3 18 23 6 9.888889
NEW JERSEY 182 158 275 106 103 99 143 253 338 184.111111
NEW MEXICO 1 3 0 37 20 0 7 6 1 8.333333
NEW YORK4 163 86 237 147 160 188 117 82 77 139.666667
NORTH CAROLINA 159 138 111 81 422 194 197 153 99 172.666667
NORTH DAKOTA 3 0 1 0 0 0 2 0 3 1.000000
OHIO 53 76 131 45 59 55 16 35 27 55.222222
OKLAHOMA 5 7 10 46 10 5 11 40 12 16.222222
OREGON 7 3 4 1 1 2 0 0 0 2.000000
PENNSYLVANIA 280 268 162 139 124 136 100 91 64 151.555556
RHODE ISLAND 16 4 3 0 11 6 1 19 5 7.222222
SOUTH CAROLINA 192 53 337 321 240 167 102 102 122 181.777778
SOUTH DAKOTA 0 0 0 0 6 0 7 0 1 1.555556
TENNESSEE 335 360 443 408 365 289 344 189 143 319.555556
TEXAS 695 500 688 624 368 527 402 593 669 562.888889
UTAH 3 7 53 1 1 10 3 0 1 8.777778
VERMONT 0 0 0 0 0 0 0 0 0 0.000000
VIRGINIA 113 58 89 78 73 46 58 50 23 65.333333
WASHINGTON 10 1 3 7 5 3 0 0 4 3.666667
WEST VIRGINIA 4 19 12 10 23 3 5 2 1 8.777778
WISCONSIN 153 137 214 165 148 138 93 100 53 133.444444
WYOMING 5 7 3 0 2 1 0 1 1 2.222222

In [17]:
a2007 = df2007.drop('Age',1)
a2007 = a2007.set_index('State')
da2007 = {'ALABAMA': a2007.loc['ALABAMA  '],
          'ALASKA' : a2007.loc['ALASKA'],
         'ARIZONA': a2007.loc['ARIZONA'],
         'ARKANSAS': a2007.loc['ARKANSAS'],
         'CALIFORNIA': a2007.loc['CALIFORNIA '],
         'COLORADO': a2007.loc['COLORADO4'],
         'CONNECTICUT': a2007.loc['CONNECTICUT'],
         'DELAWARE': a2007.loc['DELAWARE'],
         'DISTRICT OF COLUMBIA': a2007.loc['DISTRICT OF COLUMBIA4, 5'],
          'FLORIDA' : a2007.loc['FLORIDA4, 6'],
         'GEORGIA': a2007.loc['GEORGIA'],
         'HAWAII': a2007.loc['HAWAII'],
         'IDAHO': a2007.loc['IDAHO'],
         'ILLINOIS': a2007.loc['ILLINOIS'],
         'INDIANA': a2007.loc['INDIANA'],
         'IOWA': a2007.loc['IOWA'],
         'KANSAS': a2007.loc['KANSAS'],
          'KENTUCKY' : a2007.loc['KENTUCKY'],
         'LOUISIANA': a2007.loc['LOUISIANA'],
         'MAINE': a2007.loc['MAINE'],
         'MARYLAND': a2007.loc['MARYLAND'],
         'MASSACHUSETTS': a2007.loc['MASSACHUSETTS'],
         'MICHIGAN': a2007.loc['MICHIGAN'],
         'MINNESOTA': a2007.loc['MINNESOTA7'],
         'MISSISSIPPI': a2007.loc['MISSISSIPPI'],
          'MISSOURI' : a2007.loc['MISSOURI'],
         'MONTANA': a2007.loc['MONTANA'],
         'NEBRASKA': a2007.loc['NEBRASKA'],
         'NEVADA': a2007.loc['NEVADA'],
         'NEW HAMPSHIRE': a2007.loc['NEW HAMPSHIRE'],
         'NEW JERSEY': a2007.loc['NEW JERSEY'],
         'NEW MEXICO': a2007.loc['NEW MEXICO'],
         'NEW YORK': a2007.loc['NEW YORK4'],
          'NORTH CAROLINA' : a2007.loc['NORTH CAROLINA'],
         'NORTH DAKOTA': a2007.loc['NORTH DAKOTA'],
         'OHIO': a2007.loc['OHIO'],
         'OKLAHOMA': a2007.loc['OKLAHOMA'],
         'OREGON': a2007.loc['OREGON'],
         'PENNSYLVANIA': a2007.loc['PENNSYLVANIA'],
         'RHODE ISLAND': a2007.loc['RHODE ISLAND'],
         'SOUTH CAROLINA': a2007.loc['SOUTH CAROLINA'],
          'SOUTH DAKOTA' : a2007.loc['SOUTH DAKOTA'],
         'TENNESSEE': a2007.loc['TENNESSEE'],
         'TEXAS': a2007.loc['TEXAS'],
         'UTAH': a2007.loc['UTAH'],
         'VERMONT': a2007.loc['VERMONT'],
         'VIRGINIA': a2007.loc['VIRGINIA'],
         'WASHINGTON': a2007.loc['WASHINGTON'],
         'WEST VIRGINIA': a2007.loc['WEST VIRGINIA'],
          'WISCONSIN' : a2007.loc['WISCONSIN'],
         'WYOMING': a2007.loc['WYOMING']}
d2007 = pd.DataFrame(da2007)
d2007


Out[17]:
ALABAMA ALASKA ARIZONA ARKANSAS CALIFORNIA COLORADO CONNECTICUT DELAWARE DISTRICT OF COLUMBIA FLORIDA ... SOUTH DAKOTA TENNESSEE TEXAS UTAH VERMONT VIRGINIA WASHINGTON WEST VIRGINIA WISCONSIN WYOMING
Forgery and counterfeiting 1892 136 4446 811 9862 1256 792 633 0 5077 ... 52 3426 7843 990 121 2101 2111 337 2015 93
Fraud 7818 161 1983 3124 10159 2379 1441 2061 1 17277 ... 610 9323 14401 1269 414 8299 1223 1056 7346 180
Stolen property; buying, receiving, possessing 2255 21 1285 891 19752 1026 450 454 16 2891 ... 67 835 642 869 168 1015 3903 281 1687 74
Weapons; carring, possessing 1467 402 3688 957 32513 2325 1357 421 29 8263 ... 84 3404 12681 1253 27 3892 3448 289 4894 134
Drug abuse violations 17309 1759 35384 9953 289449 18290 14663 5744 77 169360 ... 1371 38899 136361 9239 1632 32941 28872 3928 25746 3110
Gambling 57 8 1 3 689 8 25 2 0 297 ... 0 335 695 3 0 113 10 4 153 5

6 rows × 51 columns


In [29]:
a2008 = df2008.drop('Age',1)
a2008 = a2008.set_index('State')
da2008 = {'ALABAMA': a2008.loc['ALABAMA  '],
          'ALASKA' : a2008.loc['ALASKA'],
         'ARIZONA': a2008.loc['ARIZONA'],
         'ARKANSAS': a2008.loc['ARKANSAS'],
         'CALIFORNIA': a2008.loc['CALIFORNIA '],
         'COLORADO': a2008.loc['COLORADO4'],
         'CONNECTICUT': a2008.loc['CONNECTICUT'],
         'DELAWARE': a2008.loc['DELAWARE'],
         'DISTRICT OF COLUMBIA': a2008.loc['DISTRICT OF COLUMBIA4, 5'],
          'FLORIDA' : a2008.loc['FLORIDA4, 6'],
         'GEORGIA': a2008.loc['GEORGIA'],
         'HAWAII': a2008.loc['HAWAII'],
         'IDAHO': a2008.loc['IDAHO'],
         'ILLINOIS': a2008.loc['ILLINOIS7'],
         'INDIANA': a2008.loc['INDIANA'],
         'IOWA': a2008.loc['IOWA'],
         'KANSAS': a2008.loc['KANSAS'],
          'KENTUCKY' : a2008.loc['KENTUCKY'],
         'LOUISIANA': a2008.loc['LOUISIANA'],
         'MAINE': a2008.loc['MAINE'],
         'MARYLAND': a2008.loc['MARYLAND'],
         'MASSACHUSETTS': a2008.loc['MASSACHUSETTS'],
         'MICHIGAN': a2008.loc['MICHIGAN'],
         'MINNESOTA': a2008.loc['MINNESOTA7'],
         'MISSISSIPPI': a2008.loc['MISSISSIPPI'],
          'MISSOURI' : a2008.loc['MISSOURI'],
         'MONTANA': a2008.loc['MONTANA'],
         'NEBRASKA': a2008.loc['NEBRASKA'],
         'NEVADA': a2008.loc['NEVADA'],
         'NEW HAMPSHIRE': a2008.loc['NEW HAMPSHIRE'],
         'NEW JERSEY': a2008.loc['NEW JERSEY'],
         'NEW MEXICO': a2008.loc['NEW MEXICO'],
         'NEW YORK': a2008.loc['NEW YORK4'],
          'NORTH CAROLINA' : a2008.loc['NORTH CAROLINA'],
         'NORTH DAKOTA': a2008.loc['NORTH DAKOTA'],
         'OHIO': a2008.loc['OHIO'],
         'OKLAHOMA': a2008.loc['OKLAHOMA'],
         'OREGON': a2008.loc['OREGON'],
         'PENNSYLVANIA': a2008.loc['PENNSYLVANIA'],
         'RHODE ISLAND': a2008.loc['RHODE ISLAND'],
         'SOUTH CAROLINA': a2008.loc['SOUTH CAROLINA'],
          'SOUTH DAKOTA' : a2008.loc['SOUTH DAKOTA'],
         'TENNESSEE': a2008.loc['TENNESSEE'],
         'TEXAS': a2008.loc['TEXAS'],
         'UTAH': a2008.loc['UTAH'],
         'VERMONT': a2008.loc['VERMONT'],
         'VIRGINIA': a2008.loc['VIRGINIA'],
         'WASHINGTON': a2008.loc['WASHINGTON'],
         'WEST VIRGINIA': a2008.loc['WEST VIRGINIA'],
          'WISCONSIN' : a2008.loc['WISCONSIN'],
         'WYOMING': a2008.loc['WYOMING']}
d2008 = pd.DataFrame(da2008)
d2008


Out[29]:
ALABAMA ALASKA ARIZONA ARKANSAS CALIFORNIA COLORADO CONNECTICUT DELAWARE DISTRICT OF COLUMBIA FLORIDA ... SOUTH DAKOTA TENNESSEE TEXAS UTAH VERMONT VIRGINIA WASHINGTON WEST VIRGINIA WISCONSIN WYOMING
Forgery and counterfeiting 1818 87 3207 937 9078 1025 789 607 3 5157 ... 109 3104 7323 927 88 2433 1567 306 1842 113
Fraud 8381 275 2352 3351 10294 2433 1471 2077 4 17336 ... 840 9361 13473 1031 346 8818 991 731 6321 226
Stolen property; buying, receiving, possessing 2295 38 1285 1224 18831 760 433 525 19 3446 ... 61 880 745 787 133 989 2792 204 1815 75
Weapons; carring, possessing 1546 345 3681 1330 31800 2054 1399 477 33 8092 ... 129 3238 11667 1200 18 4035 2879 268 4997 136
Drug abuse violations 16488 1716 34242 11513 268763 17851 16132 5895 79 159916 ... 2395 34686 136897 9242 1137 32513 23440 4249 25075 2969
Gambling 58 0 7 24 615 7 37 6 1 464 ... 0 360 500 7 0 58 1 19 137 7

6 rows × 51 columns


In [19]:
a2009 = df2009.drop('Age',1)
a2009 = a2009.set_index('State')
da2009 = {'ALABAMA': a2009.loc['ALABAMA  '],
          'ALASKA' : a2009.loc['ALASKA'],
         'ARIZONA': a2009.loc['ARIZONA'],
         'ARKANSAS': a2009.loc['ARKANSAS'],
         'CALIFORNIA': a2009.loc['CALIFORNIA '],
         'COLORADO': a2009.loc['COLORADO'],
         'CONNECTICUT': a2009.loc['CONNECTICUT'],
         'DELAWARE': a2009.loc['DELAWARE'],
         'DISTRICT OF COLUMBIA': a2009.loc['DISTRICT OF COLUMBIA4, 5'],
          'FLORIDA' : a2009.loc['FLORIDA4, 6'],
         'GEORGIA': a2009.loc['GEORGIA'],
         'HAWAII': a2009.loc['HAWAII'],
         'IDAHO': a2009.loc['IDAHO'],
         'ILLINOIS': a2009.loc['ILLINOIS7'],
         'INDIANA': a2009.loc['INDIANA'],
         'IOWA': a2009.loc['IOWA'],
         'KANSAS': a2009.loc['KANSAS'],
          'KENTUCKY' : a2009.loc['KENTUCKY'],
         'LOUISIANA': a2009.loc['LOUISIANA'],
         'MAINE': a2009.loc['MAINE'],
         'MARYLAND': a2009.loc['MARYLAND'],
         'MASSACHUSETTS': a2009.loc['MASSACHUSETTS'],
         'MICHIGAN': a2009.loc['MICHIGAN'],
         'MINNESOTA': a2009.loc['MINNESOTA7'],
         'MISSISSIPPI': a2009.loc['MISSISSIPPI'],
          'MISSOURI' : a2009.loc['MISSOURI'],
         'MONTANA': a2009.loc['MONTANA'],
         'NEBRASKA': a2009.loc['NEBRASKA'],
         'NEVADA': a2009.loc['NEVADA'],
         'NEW HAMPSHIRE': a2009.loc['NEW HAMPSHIRE'],
         'NEW JERSEY': a2009.loc['NEW JERSEY'],
         'NEW MEXICO': a2009.loc['NEW MEXICO'],
         'NEW YORK': a2009.loc['NEW YORK4'],
          'NORTH CAROLINA' : a2009.loc['NORTH CAROLINA'],
         'NORTH DAKOTA': a2009.loc['NORTH DAKOTA'],
         'OHIO': a2009.loc['OHIO'],
         'OKLAHOMA': a2009.loc['OKLAHOMA'],
         'OREGON': a2009.loc['OREGON'],
         'PENNSYLVANIA': a2009.loc['PENNSYLVANIA'],
         'RHODE ISLAND': a2009.loc['RHODE ISLAND'],
         'SOUTH CAROLINA': a2009.loc['SOUTH CAROLINA'],
          'SOUTH DAKOTA' : a2009.loc['SOUTH DAKOTA'],
         'TENNESSEE': a2009.loc['TENNESSEE'],
         'TEXAS': a2009.loc['TEXAS'],
         'UTAH': a2009.loc['UTAH'],
         'VERMONT': a2009.loc['VERMONT'],
         'VIRGINIA': a2009.loc['VIRGINIA'],
         'WASHINGTON': a2009.loc['WASHINGTON'],
         'WEST VIRGINIA': a2009.loc['WEST VIRGINIA'],
          'WISCONSIN' : a2009.loc['WISCONSIN'],
         'WYOMING': a2009.loc['WYOMING']}
d2009 = pd.DataFrame(da2009)

In [20]:
a2010 = df2010.drop('Age',1)
a2010 = a2010.set_index('State')
da2010 = {'ALABAMA': a2010.loc['ALABAMA  '],
          'ALASKA' : a2010.loc['ALASKA'],
         'ARIZONA': a2010.loc['ARIZONA'],
         'ARKANSAS': a2010.loc['ARKANSAS'],
         'CALIFORNIA': a2010.loc['CALIFORNIA '],
         'COLORADO': a2010.loc['COLORADO'],
         'CONNECTICUT': a2010.loc['CONNECTICUT'],
         'DELAWARE': a2010.loc['DELAWARE'],
         'DISTRICT OF COLUMBIA': a2010.loc['DISTRICT OF COLUMBIA4, 5'],
          'FLORIDA' : a2010.loc['FLORIDA4, 6'],
         'GEORGIA': a2010.loc['GEORGIA'],
         'HAWAII': a2010.loc['HAWAII'],
         'IDAHO': a2010.loc['IDAHO'],
         'ILLINOIS': a2010.loc['ILLINOIS7'],
         'INDIANA': a2010.loc['INDIANA'],
         'IOWA': a2010.loc['IOWA'],
         'KANSAS': a2010.loc['KANSAS'],
          'KENTUCKY' : a2010.loc['KENTUCKY'],
         'LOUISIANA': a2010.loc['LOUISIANA'],
         'MAINE': a2010.loc['MAINE'],
         'MARYLAND': a2010.loc['MARYLAND'],
         'MASSACHUSETTS': a2010.loc['MASSACHUSETTS'],
         'MICHIGAN': a2010.loc['MICHIGAN'],
         'MINNESOTA': a2010.loc['MINNESOTA7'],
         'MISSISSIPPI': a2010.loc['MISSISSIPPI'],
          'MISSOURI' : a2010.loc['MISSOURI'],
         'MONTANA': a2010.loc['MONTANA'],
         'NEBRASKA': a2010.loc['NEBRASKA'],
         'NEVADA': a2010.loc['NEVADA'],
         'NEW HAMPSHIRE': a2010.loc['NEW HAMPSHIRE'],
         'NEW JERSEY': a2010.loc['NEW JERSEY'],
         'NEW MEXICO': a2010.loc['NEW MEXICO'],
         'NEW YORK': a2010.loc['NEW YORK4'],
          'NORTH CAROLINA' : a2010.loc['NORTH CAROLINA'],
         'NORTH DAKOTA': a2010.loc['NORTH DAKOTA'],
         'OHIO': a2010.loc['OHIO'],
         'OKLAHOMA': a2010.loc['OKLAHOMA'],
         'OREGON': a2010.loc['OREGON'],
         'PENNSYLVANIA': a2010.loc['PENNSYLVANIA'],
         'RHODE ISLAND': a2010.loc['RHODE ISLAND'],
         'SOUTH CAROLINA': a2010.loc['SOUTH CAROLINA'],
          'SOUTH DAKOTA' : a2010.loc['SOUTH DAKOTA'],
         'TENNESSEE': a2010.loc['TENNESSEE'],
         'TEXAS': a2010.loc['TEXAS'],
         'UTAH': a2010.loc['UTAH'],
         'VERMONT': a2010.loc['VERMONT'],
         'VIRGINIA': a2010.loc['VIRGINIA'],
         'WASHINGTON': a2010.loc['WASHINGTON'],
         'WEST VIRGINIA': a2010.loc['WEST VIRGINIA'],
          'WISCONSIN' : a2010.loc['WISCONSIN'],
         'WYOMING': a2010.loc['WYOMING']}
d2010 = pd.DataFrame(da2010)

In [21]:
a2011 = df2011.drop('Age',1)
a2011 = a2011.set_index('State')
da2011 = {'ALABAMA': a2011.loc['ALABAMA4  '],
          'ALASKA' : a2011.loc['ALASKA'],
         'ARIZONA': a2011.loc['ARIZONA'],
         'ARKANSAS': a2011.loc['ARKANSAS'],
         'CALIFORNIA': a2011.loc['CALIFORNIA '],
         'COLORADO': a2011.loc['COLORADO'],
         'CONNECTICUT': a2011.loc['CONNECTICUT'],
         'DELAWARE': a2011.loc['DELAWARE'],
         'DISTRICT OF COLUMBIA': a2011.loc['DISTRICT OF COLUMBIA5'],
          'FLORIDA' : a2011.loc['FLORIDA4, 6'],
         'GEORGIA': a2011.loc['GEORGIA'],
         'HAWAII': a2011.loc['HAWAII'],
         'IDAHO': a2011.loc['IDAHO'],
         'ILLINOIS': a2011.loc['ILLINOIS7'],
         'INDIANA': a2011.loc['INDIANA'],
         'IOWA': a2011.loc['IOWA'],
         'KANSAS': a2011.loc['KANSAS'],
          'KENTUCKY' : a2011.loc['KENTUCKY'],
         'LOUISIANA': a2011.loc['LOUISIANA'],
         'MAINE': a2011.loc['MAINE'],
         'MARYLAND': a2011.loc['MARYLAND'],
         'MASSACHUSETTS': a2011.loc['MASSACHUSETTS'],
         'MICHIGAN': a2011.loc['MICHIGAN'],
         'MINNESOTA': a2011.loc['MINNESOTA7'],
         'MISSISSIPPI': a2011.loc['MISSISSIPPI'],
          'MISSOURI' : a2011.loc['MISSOURI'],
         'MONTANA': a2011.loc['MONTANA'],
         'NEBRASKA': a2011.loc['NEBRASKA'],
         'NEVADA': a2011.loc['NEVADA'],
         'NEW HAMPSHIRE': a2011.loc['NEW HAMPSHIRE'],
         'NEW JERSEY': a2011.loc['NEW JERSEY'],
         'NEW MEXICO': a2011.loc['NEW MEXICO'],
         'NEW YORK': a2011.loc['NEW YORK4'],
          'NORTH CAROLINA' : a2011.loc['NORTH CAROLINA'],
         'NORTH DAKOTA': a2011.loc['NORTH DAKOTA'],
         'OHIO': a2011.loc['OHIO'],
         'OKLAHOMA': a2011.loc['OKLAHOMA'],
         'OREGON': a2011.loc['OREGON'],
         'PENNSYLVANIA': a2011.loc['PENNSYLVANIA'],
         'RHODE ISLAND': a2011.loc['RHODE ISLAND'],
         'SOUTH CAROLINA': a2011.loc['SOUTH CAROLINA'],
          'SOUTH DAKOTA' : a2011.loc['SOUTH DAKOTA'],
         'TENNESSEE': a2011.loc['TENNESSEE'],
         'TEXAS': a2011.loc['TEXAS'],
         'UTAH': a2011.loc['UTAH'],
         'VERMONT': a2011.loc['VERMONT'],
         'VIRGINIA': a2011.loc['VIRGINIA'],
         'WASHINGTON': a2011.loc['WASHINGTON'],
         'WEST VIRGINIA': a2011.loc['WEST VIRGINIA'],
          'WISCONSIN' : a2011.loc['WISCONSIN'],
         'WYOMING': a2011.loc['WYOMING']}
d2011 = pd.DataFrame(da2011)

In [22]:
a2012 = df2012.drop('Age',1)
a2012 = a2012.set_index('State')
da2012 = {'ALABAMA': a2012.loc['ALABAMA4  '],
          'ALASKA' : a2012.loc['ALASKA'],
         'ARIZONA': a2012.loc['ARIZONA'],
         'ARKANSAS': a2012.loc['ARKANSAS'],
         'CALIFORNIA': a2012.loc['CALIFORNIA '],
         'COLORADO': a2012.loc['COLORADO'],
         'CONNECTICUT': a2012.loc['CONNECTICUT'],
         'DELAWARE': a2012.loc['DELAWARE'],
         'DISTRICT OF COLUMBIA': a2012.loc['DISTRICT OF COLUMBIA4, 5'],
          'FLORIDA' : a2012.loc['FLORIDA4, 6'],
         'GEORGIA': a2012.loc['GEORGIA'],
         'HAWAII': a2012.loc['HAWAII'],
         'IDAHO': a2012.loc['IDAHO'],
         'ILLINOIS': a2012.loc['ILLINOIS7'],
         'INDIANA': a2012.loc['INDIANA'],
         'IOWA': a2012.loc['IOWA'],
         'KANSAS': a2012.loc['KANSAS'],
          'KENTUCKY' : a2012.loc['KENTUCKY'],
         'LOUISIANA': a2012.loc['LOUISIANA'],
         'MAINE': a2012.loc['MAINE'],
         'MARYLAND': a2012.loc['MARYLAND'],
         'MASSACHUSETTS': a2012.loc['MASSACHUSETTS'],
         'MICHIGAN': a2012.loc['MICHIGAN'],
         'MINNESOTA': a2012.loc['MINNESOTA8'],
         'MISSISSIPPI': a2012.loc['MISSISSIPPI'],
          'MISSOURI' : a2012.loc['MISSOURI'],
         'MONTANA': a2012.loc['MONTANA'],
         'NEBRASKA': a2012.loc['NEBRASKA'],
         'NEVADA': a2012.loc['NEVADA'],
         'NEW HAMPSHIRE': a2012.loc['NEW HAMPSHIRE'],
         'NEW JERSEY': a2012.loc['NEW JERSEY'],
         'NEW MEXICO': a2012.loc['NEW MEXICO'],
         'NEW YORK': a2012.loc['NEW YORK4'],
          'NORTH CAROLINA' : a2012.loc['NORTH CAROLINA'],
         'NORTH DAKOTA': a2012.loc['NORTH DAKOTA'],
         'OHIO': a2012.loc['OHIO'],
         'OKLAHOMA': a2012.loc['OKLAHOMA'],
         'OREGON': a2012.loc['OREGON'],
         'PENNSYLVANIA': a2012.loc['PENNSYLVANIA'],
         'RHODE ISLAND': a2012.loc['RHODE ISLAND'],
         'SOUTH CAROLINA': a2012.loc['SOUTH CAROLINA'],
          'SOUTH DAKOTA' : a2012.loc['SOUTH DAKOTA'],
         'TENNESSEE': a2012.loc['TENNESSEE'],
         'TEXAS': a2012.loc['TEXAS'],
         'UTAH': a2012.loc['UTAH'],
         'VERMONT': a2012.loc['VERMONT'],
         'VIRGINIA': a2012.loc['VIRGINIA'],
         'WASHINGTON': a2012.loc['WASHINGTON'],
         'WEST VIRGINIA': a2012.loc['WEST VIRGINIA'],
          'WISCONSIN' : a2012.loc['WISCONSIN'],
         'WYOMING': a2012.loc['WYOMING']}
d2012 = pd.DataFrame(da2012)

In [23]:
a2013 = df2013.drop('Age',1)
a2013 = a2013.set_index('State')
da2013 = {'ALABAMA': a2013.loc['ALABAMA5  '],
          'ALASKA' : a2013.loc['ALASKA'],
         'ARIZONA': a2013.loc['ARIZONA'],
         'ARKANSAS': a2013.loc['ARKANSAS'],
         'CALIFORNIA': a2013.loc['CALIFORNIA '],
         'COLORADO': a2013.loc['COLORADO'],
         'CONNECTICUT': a2013.loc['CONNECTICUT'],
         'DELAWARE': a2013.loc['DELAWARE'],
         'DISTRICT OF COLUMBIA': a2013.loc['DISTRICT OF COLUMBIA6'],
          'FLORIDA' : a2013.loc['FLORIDA5, 7'],
         'GEORGIA': a2013.loc['GEORGIA'],
         'HAWAII': a2013.loc['HAWAII'],
         'IDAHO': a2013.loc['IDAHO'],
         'ILLINOIS': a2013.loc['ILLINOIS8'],
         'INDIANA': a2013.loc['INDIANA'],
         'IOWA': a2013.loc['IOWA'],
         'KANSAS': a2013.loc['KANSAS'],
          'KENTUCKY' : a2013.loc['KENTUCKY'],
         'LOUISIANA': a2013.loc['LOUISIANA'],
         'MAINE': a2013.loc['MAINE'],
         'MARYLAND': a2013.loc['MARYLAND'],
         'MASSACHUSETTS': a2013.loc['MASSACHUSETTS'],
         'MICHIGAN': a2013.loc['MICHIGAN'],
         'MINNESOTA': a2013.loc['MINNESOTA'],
         'MISSISSIPPI': a2013.loc['MISSISSIPPI'],
          'MISSOURI' : a2013.loc['MISSOURI'],
         'MONTANA': a2013.loc['MONTANA'],
         'NEBRASKA': a2013.loc['NEBRASKA'],
         'NEVADA': a2013.loc['NEVADA'],
         'NEW HAMPSHIRE': a2013.loc['NEW HAMPSHIRE'],
         'NEW JERSEY': a2013.loc['NEW JERSEY'],
         'NEW MEXICO': a2013.loc['NEW MEXICO'],
         'NEW YORK': a2013.loc['NEW YORK5'],
          'NORTH CAROLINA' : a2013.loc['NORTH CAROLINA'],
         'NORTH DAKOTA': a2013.loc['NORTH DAKOTA'],
         'OHIO': a2013.loc['OHIO'],
         'OKLAHOMA': a2013.loc['OKLAHOMA'],
         'OREGON': a2013.loc['OREGON'],
         'PENNSYLVANIA': a2013.loc['PENNSYLVANIA'],
         'RHODE ISLAND': a2013.loc['RHODE ISLAND'],
         'SOUTH CAROLINA': a2013.loc['SOUTH CAROLINA'],
          'SOUTH DAKOTA' : a2013.loc['SOUTH DAKOTA'],
         'TENNESSEE': a2013.loc['TENNESSEE'],
         'TEXAS': a2013.loc['TEXAS'],
         'UTAH': a2013.loc['UTAH'],
         'VERMONT': a2013.loc['VERMONT'],
         'VIRGINIA': a2013.loc['VIRGINIA'],
         'WASHINGTON': a2013.loc['WASHINGTON'],
         'WEST VIRGINIA': a2013.loc['WEST VIRGINIA'],
          'WISCONSIN' : a2013.loc['WISCONSIN'],
         'WYOMING': a2013.loc['WYOMING']}
d2013 = pd.DataFrame(da2013)

In [24]:
a2014 = df2014.drop('Age',1)
a2014 = a2014.set_index('State')
da2014 = {'ALABAMA': a2014.loc['ALABAMA5  '],
          'ALASKA' : a2014.loc['ALASKA'],
         'ARIZONA': a2014.loc['ARIZONA'],
         'ARKANSAS': a2014.loc['ARKANSAS'],
         'CALIFORNIA': a2014.loc['CALIFORNIA '],
         'COLORADO': a2014.loc['COLORADO'],
         'CONNECTICUT': a2014.loc['CONNECTICUT'],
         'DELAWARE': a2014.loc['DELAWARE'],
         'DISTRICT OF COLUMBIA': a2014.loc['DISTRICT OF COLUMBIA6'],
          'FLORIDA' : a2014.loc['FLORIDA5,7'],
         'GEORGIA': a2014.loc['GEORGIA8'],
         'HAWAII': a2014.loc['HAWAII'],
         'IDAHO': a2014.loc['IDAHO'],
         'ILLINOIS': a2014.loc['ILLINOIS5'],
         'INDIANA': a2014.loc['INDIANA'],
         'IOWA': a2014.loc['IOWA'],
         'KANSAS': a2014.loc['KANSAS'],
          'KENTUCKY' : a2014.loc['KENTUCKY'],
         'LOUISIANA': a2014.loc['LOUISIANA'],
         'MAINE': a2014.loc['MAINE'],
         'MARYLAND': a2014.loc['MARYLAND'],
         'MASSACHUSETTS': a2014.loc['MASSACHUSETTS'],
         'MICHIGAN': a2014.loc['MICHIGAN'],
         'MINNESOTA': a2014.loc['MINNESOTA'],
         'MISSISSIPPI': a2014.loc['MISSISSIPPI'],
          'MISSOURI' : a2014.loc['MISSOURI'],
         'MONTANA': a2014.loc['MONTANA'],
         'NEBRASKA': a2014.loc['NEBRASKA'],
         'NEVADA': a2014.loc['NEVADA'],
         'NEW HAMPSHIRE': a2014.loc['NEW HAMPSHIRE'],
         'NEW JERSEY': a2014.loc['NEW JERSEY'],
         'NEW MEXICO': a2014.loc['NEW MEXICO'],
         'NEW YORK': a2014.loc['NEW YORK5'],
          'NORTH CAROLINA' : a2014.loc['NORTH CAROLINA'],
         'NORTH DAKOTA': a2014.loc['NORTH DAKOTA'],
         'OHIO': a2014.loc['OHIO'],
         'OKLAHOMA': a2014.loc['OKLAHOMA'],
         'OREGON': a2014.loc['OREGON'],
         'PENNSYLVANIA': a2014.loc['PENNSYLVANIA'],
         'RHODE ISLAND': a2014.loc['RHODE ISLAND'],
         'SOUTH CAROLINA': a2014.loc['SOUTH CAROLINA'],
          'SOUTH DAKOTA' : a2014.loc['SOUTH DAKOTA'],
         'TENNESSEE': a2014.loc['TENNESSEE'],
         'TEXAS': a2014.loc['TEXAS'],
         'UTAH': a2014.loc['UTAH'],
         'VERMONT': a2014.loc['VERMONT'],
         'VIRGINIA': a2014.loc['VIRGINIA'],
         'WASHINGTON': a2014.loc['WASHINGTON'],
         'WEST VIRGINIA': a2014.loc['WEST VIRGINIA'],
          'WISCONSIN' : a2014.loc['WISCONSIN'],
         'WYOMING': a2014.loc['WYOMING']}
d2014 = pd.DataFrame(da2014)

In [25]:
a2015 = df2015.drop('Age',1)
a2015 = a2015.set_index('State')
da2015 = {'ALABAMA': a2015.loc['ALABAMA  '],
          'ALASKA' : a2015.loc['ALASKA'],
         'ARIZONA': a2015.loc['ARIZONA'],
         'ARKANSAS': a2015.loc['ARKANSAS'],
         'CALIFORNIA': a2015.loc['CALIFORNIA '],
         'COLORADO': a2015.loc['COLORADO'],
         'CONNECTICUT': a2015.loc['CONNECTICUT'],
         'DELAWARE': a2015.loc['DELAWARE'],
         'DISTRICT OF COLUMBIA': a2015.loc['DISTRICT OF COLUMBIA5'],
          'FLORIDA' : a2015.loc['FLORIDA6,7'],
         'GEORGIA': a2015.loc['GEORGIA'],
         'HAWAII': a2015.loc['HAWAII'],
         'IDAHO': a2015.loc['IDAHO'],
         'ILLINOIS': a2015.loc['ILLINOIS6'],
         'INDIANA': a2015.loc['INDIANA'],
         'IOWA': a2015.loc['IOWA'],
         'KANSAS': a2015.loc['KANSAS'],
          'KENTUCKY' : a2015.loc['KENTUCKY'],
         'LOUISIANA': a2015.loc['LOUISIANA'],
         'MAINE': a2015.loc['MAINE'],
         'MARYLAND': a2015.loc['MARYLAND'],
         'MASSACHUSETTS': a2015.loc['MASSACHUSETTS'],
         'MICHIGAN': a2015.loc['MICHIGAN'],
         'MINNESOTA': a2015.loc['MINNESOTA'],
         'MISSISSIPPI': a2015.loc['MISSISSIPPI'],
          'MISSOURI' : a2015.loc['MISSOURI'],
         'MONTANA': a2015.loc['MONTANA'],
         'NEBRASKA': a2015.loc['NEBRASKA'],
         'NEVADA': a2015.loc['NEVADA'],
         'NEW HAMPSHIRE': a2015.loc['NEW HAMPSHIRE'],
         'NEW JERSEY': a2015.loc['NEW JERSEY'],
         'NEW MEXICO': a2015.loc['NEW MEXICO'],
         'NEW YORK': a2015.loc['NEW YORK6'],
          'NORTH CAROLINA' : a2015.loc['NORTH CAROLINA'],
         'NORTH DAKOTA': a2015.loc['NORTH DAKOTA'],
         'OHIO': a2015.loc['OHIO'],
         'OKLAHOMA': a2015.loc['OKLAHOMA'],
         'OREGON': a2015.loc['OREGON'],
         'PENNSYLVANIA': a2015.loc['PENNSYLVANIA'],
         'RHODE ISLAND': a2015.loc['RHODE ISLAND'],
         'SOUTH CAROLINA': a2015.loc['SOUTH CAROLINA'],
          'SOUTH DAKOTA' : a2015.loc['SOUTH DAKOTA'],
         'TENNESSEE': a2015.loc['TENNESSEE'],
         'TEXAS': a2015.loc['TEXAS8'],
         'UTAH': a2015.loc['UTAH'],
         'VERMONT': a2015.loc['VERMONT'],
         'VIRGINIA': a2015.loc['VIRGINIA'],
         'WASHINGTON': a2015.loc['WASHINGTON'],
         'WEST VIRGINIA': a2015.loc['WEST VIRGINIA'],
          'WISCONSIN' : a2015.loc['WISCONSIN'],
         'WYOMING': a2015.loc['WYOMING']}
d2015 = pd.DataFrame(da2015)

In [26]:
# Pie chart of percentage of each crime based on year
colors = ["#E13F29", "#D69A80", "#D63B59", "#AE5552", "#CB5C3B", "#EB8076", "#96624E"]


for each in d2007.columns.values:
# Create a pie chart
    plt.title(each + ' in 2007', y = 1.1)
    plt.pie(
        # using data total)arrests
        d2007[each],
        # with the labels being officer names
        labels=d2007.index.values,
        # with no shadows
        shadow=False,
        # with colors
        colors=colors,
        # with one slide exploded out

        # with the start angle at 90%
        startangle=90,
        # with the percent listed as a fraction
        autopct='%1.1f%%',
    )
    
    # View the plot drop above
    plt.axis('equal')
    
    # View the plot
    plt.tight_layout()
    
    
    plt.show()



In [27]:
# Pie chart of percentage of specific crimes at different location at different years

colors = ["#E13F29", "#D69A80", "#D63B59", "#AE5552", "#CB5C3B", "#EB8076", "#96624E"]


for each in dfDrug.columns.values:
# Create a pie chart
    plt.title(each, y = 1.1)
    plt.pie(
        # using data total)arrests
        dfDrug[each],
        # with the labels being officer names
        labels=dfDrug.index.values,
        # with no shadows
        shadow=False,
        # with colors
        colors=colors,
        # with one slide exploded out
        # with the start angle at 90%
        startangle=90,
        # with the percent listed as a fraction
        autopct='%1.1f%%',
    )
    
    # View the plot drop above
    plt.axis('equal')
    
    # View the plot
    plt.tight_layout()
    
    
    plt.show()



In [28]:
plt.title('ALABAMA in 2012', y = 1.1)
plt.pie(
    # using data total)arrests
    d2012['ALABAMA'],
    # with the labels being officer names
    labels=d2012.index.values,
    # with no shadows
    shadow=False,
    # with colors
    colors=colors,
    # with one slide exploded out

    # with the start angle at 90%
    startangle=90,
    # with the percent listed as a fraction
    autopct='%1.1f%%',
)

# View the plot drop above
plt.axis('equal')

# View the plot
plt.tight_layout()


plt.show()



In [33]:
dfDrug['2007'].sum(axis=0)


Out[33]:
1555754

In [62]:
daDrug = {'year': ['2007', '2008', '2009', '2010', '2011', '2012,', '2013', '2014', '2015'], 
        'sum': [dfDrug['2007'].sum(axis=0), dfDrug['2008'].sum(axis=0), 
                dfDrug['2009'].sum(axis=0), dfDrug['2010'].sum(axis=0), 
                dfDrug['2011'].sum(axis=0), dfDrug['2012'].sum(axis=0),
               dfDrug['2013'].sum(axis=0),dfDrug['2014'].sum(axis=0),dfDrug['2015'].sum(axis=0)]}
dDrug = pd.DataFrame(daDrug)
dDrug = dDrug.set_index('year')
dDrug.plot(kind='bar', title='Total Arrests related to Drugs Across the US')

In [78]:



Out[78]:
<matplotlib.axes._subplots.AxesSubplot at 0x117fc8390>

In [67]:
daGamble = {'year': ['2007', '2008', '2009', '2010', '2011', '2012,', '2013', '2014', '2015'], 
        'sum': [dfGamble['2007'].sum(axis=0), dfGamble['2008'].sum(axis=0), 
                dfGamble['2009'].sum(axis=0), dfGamble['2010'].sum(axis=0), 
                dfGamble['2011'].sum(axis=0), dfGamble['2012'].sum(axis=0),
               dfGamble['2013'].sum(axis=0),dfGamble['2014'].sum(axis=0),dfGamble['2015'].sum(axis=0)]}
dGamble = pd.DataFrame(daGamble)
dGamble = dGamble.set_index('year')
dGamble.plot(kind='bar', title='Total Arrests related to Gambling Across the US')


Out[67]:
<matplotlib.axes._subplots.AxesSubplot at 0x1169be910>

In [79]:
daFraud = {'year': ['2007', '2008', '2009', '2010', '2011', '2012,', '2013', '2014', '2015'], 
        'sum': [dfFraud['2007'].sum(axis=0), dfFraud['2008'].sum(axis=0), 
                dfFraud['2009'].sum(axis=0), dfFraud['2010'].sum(axis=0), 
                dfFraud['2011'].sum(axis=0), dfFraud['2012'].sum(axis=0),
               dfFraud['2013'].sum(axis=0),dfFraud['2014'].sum(axis=0),dfFraud['2015'].sum(axis=0)]}
dFraud = pd.DataFrame(daFraud)
dFraud = dFraud.set_index('year')
dFraud.plot(kind='bar', title='Total Arrests related to Fraud Across the US')


Out[79]:
<matplotlib.axes._subplots.AxesSubplot at 0x119958610>

In [80]:
daForgery = {'year': ['2007', '2008', '2009', '2010', '2011', '2012,', '2013', '2014', '2015'], 
        'sum': [dfForgery['2007'].sum(axis=0), dfForgery['2008'].sum(axis=0), 
                dfForgery['2009'].sum(axis=0), dfForgery['2010'].sum(axis=0), 
                dfForgery['2011'].sum(axis=0), dfForgery['2012'].sum(axis=0),
               dfForgery['2013'].sum(axis=0),dfForgery['2014'].sum(axis=0),dfForgery['2015'].sum(axis=0)]}
dForgery = pd.DataFrame(daForgery)
dForgery = dForgery.set_index('year')
dForgery.plot(kind='bar', title='Total Arrests related to Forgery Across the US')


Out[80]:
<matplotlib.axes._subplots.AxesSubplot at 0x119a429d0>

In [76]:
daWeapons = {'year': ['2007', '2008', '2009', '2010', '2011', '2012,', '2013', '2014', '2015'], 
        'sum': [dfWeapons['2007'].sum(axis=0), dfWeapons['2008'].sum(axis=0), 
                dfWeapons['2009'].sum(axis=0), dfWeapons['2010'].sum(axis=0), 
                dfWeapons['2011'].sum(axis=0), dfWeapons['2012'].sum(axis=0),
               dfWeapons['2013'].sum(axis=0),dfWeapons['2014'].sum(axis=0),dfWeapons['2015'].sum(axis=0)]}
dWeapons = pd.DataFrame(daWeapons)
dWeapons = dWeapons.set_index('year')
dWeapons.plot(kind='bar', title='Total Arrests related to Weapons Across the US')


Out[76]:
<matplotlib.axes._subplots.AxesSubplot at 0x115b25e10>

In [75]:
daStolen = {'year': ['2007', '2008', '2009', '2010', '2011', '2012,', '2013', '2014', '2015'], 
        'sum': [dfStolen['2007'].sum(axis=0), dfStolen['2008'].sum(axis=0), 
                dfStolen['2009'].sum(axis=0), dfStolen['2010'].sum(axis=0), 
                dfStolen['2011'].sum(axis=0), dfStolen['2012'].sum(axis=0),
               dfStolen['2013'].sum(axis=0),dfStolen['2014'].sum(axis=0),dfStolen['2015'].sum(axis=0)]}
dStolen = pd.DataFrame(daStolen)
dStolen = dStolen.set_index('year')
dStolen.plot(kind='bar', title='Total Arrests related to Stolen Across the US')


Out[75]:
<matplotlib.axes._subplots.AxesSubplot at 0x117f238d0>

In [ ]: