{ "cells": [ { "cell_type": "code", "execution_count": 4, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
nameagegenderraceethnicitymonthdayyearstreetaddresscitystate...share_hispanicp_incomeh_incomecounty_incomecomp_incomecounty_bucketnat_bucketpovuratecollege
0A'donte Washington16MaleBlackFebruary232015Clearview LnMillbrookAL...5.62837551367547660.9379363314.10.0976860.168510
1Aaron Rutledge27MaleWhiteApril22015300 block Iris Park DrPinevilleLA...0.51467827972409300.6834112128.80.0657240.111402
2Aaron Siler26MaleWhiteMarch14201522nd Ave and 56th StKenoshaWI...16.82528645365549300.8258692314.60.1662930.147312
3Aaron Valdez25MaleHispanic/LatinoMarch1120153000 Seminole AveSouth GateCA...98.81719448295559090.8638143311.70.1248270.050133
4Adam Jovicic29MaleWhiteMarch192015364 Hiwood AveMunroe FallsOH...1.73395468785496691.384868541.90.0635500.403954
\n", "

5 rows × 34 columns

\n", "
" ], "text/plain": [ " name age gender raceethnicity month day year \\\n", "0 A'donte Washington 16 Male Black February 23 2015 \n", "1 Aaron Rutledge 27 Male White April 2 2015 \n", "2 Aaron Siler 26 Male White March 14 2015 \n", "3 Aaron Valdez 25 Male Hispanic/Latino March 11 2015 \n", "4 Adam Jovicic 29 Male White March 19 2015 \n", "\n", " streetaddress city state ... share_hispanic \\\n", "0 Clearview Ln Millbrook AL ... 5.6 \n", "1 300 block Iris Park Dr Pineville LA ... 0.5 \n", "2 22nd Ave and 56th St Kenosha WI ... 16.8 \n", "3 3000 Seminole Ave South Gate CA ... 98.8 \n", "4 364 Hiwood Ave Munroe Falls OH ... 1.7 \n", "\n", " p_income h_income county_income comp_income county_bucket nat_bucket \\\n", "0 28375 51367 54766 0.937936 3 3 \n", "1 14678 27972 40930 0.683411 2 1 \n", "2 25286 45365 54930 0.825869 2 3 \n", "3 17194 48295 55909 0.863814 3 3 \n", "4 33954 68785 49669 1.384868 5 4 \n", "\n", " pov urate college \n", "0 14.1 0.097686 0.168510 \n", "1 28.8 0.065724 0.111402 \n", "2 14.6 0.166293 0.147312 \n", "3 11.7 0.124827 0.050133 \n", "4 1.9 0.063550 0.403954 \n", "\n", "[5 rows x 34 columns]" ] }, "execution_count": 4, "metadata": {}, "output_type": "execute_result" } ], "source": [ "import pandas as pd\n", "police_killings = pd.read_csv(\"police_killings.csv\", encoding=\"ISO-8859-1\")\n", "police_killings.head(5)" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "Index(['name', 'age', 'gender', 'raceethnicity', 'month', 'day', 'year',\n", " 'streetaddress', 'city', 'state', 'latitude', 'longitude', 'state_fp',\n", " 'county_fp', 'tract_ce', 'geo_id', 'county_id', 'namelsad',\n", " 'lawenforcementagency', 'cause', 'armed', 'pop', 'share_white',\n", " 'share_black', 'share_hispanic', 'p_income', 'h_income',\n", " 'county_income', 'comp_income', 'county_bucket', 'nat_bucket', 'pov',\n", " 'urate', 'college'],\n", " dtype='object')" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "police_killings.columns" ] }, { "cell_type": "code", "execution_count": 10, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "['White',\n", " 'Black',\n", " 'Hispanic/Latino',\n", " 'Unknown',\n", " 'Asian/Pacific Islander',\n", " 'Native American']" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "counts = police_killings[\"raceethnicity\"].value_counts()" ] }, { "cell_type": "code", "execution_count": 14, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "([,\n", " ,\n", " ,\n", " ,\n", " ,\n", " ],\n", " )" ] }, "execution_count": 14, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": [ "iVBORw0KGgoAAAANSUhEUgAAAXIAAAFgCAYAAACmOvKZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\n", "AAALEgAACxIB0t1+/AAAH+ZJREFUeJzt3XnYXHV9/vH3bQIKBATEhi0CVrZUZFFQRGrAFnBjqcgi\n", "Koo/ai9+FsS6Yauk2KpV4XIXWxGjAhI3BPuTLQVRQFMQBAyrECVAgiBIgiAB7t8f5zxk8vBsSWbm\n", "5Hvmfl3XXJk5M8P5DHlyP2e+53s+X9kmIiLK9YymC4iIiFWTII+IKFyCPCKicAnyiIjCJcgjIgqX\n", "II+IKNyYQS5pmqRLJP1a0g2Sjq23z5S0QNI19e3VHe85QdKtkm6StE+vP0BExKDTWPPIJW0MbGz7\n", "WklTgKuBA4FDgMW2Txn2+unAmcCuwGbAxcA2tp/sUf0REQNvzCNy2wttX1vfXwLcSBXQABrhLQcA\n", "Z9leans+cBuwW/fKjYiI4SY8Ri5pS2Bn4Of1pn+U9CtJp0lav962KbCg420LWBb8ERHRA5Mn8qJ6\n", "WOW7wHG2l0j6MnBS/fRHgZOBd4zy9qeN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PzCrvj8LOLC+fwBw\n", "lu2ltucDtwG7dafUiIgYycoeLU+1vai+vwiYWt/fFFjQ8boFwGYruY+IiJiAyav6H7BtSR7rJSNv\n", "ntlxf0Z9i4iIIZJmMIFwXNkgXyRpY9sLJW0C3FtvvwuY1vG6zettI5i5kruOiBgMti8FLh16LOnE\n", "kV63skMr5wJH1vePBM7p2H6YpDUlbQVsDcxdyX1ERMQEjHtELuks4JXARpLuBD4CfAKYLekdwHzg\n", "EADb8yTNBuYBjwPH2B5r2CUiIlaRmsjZaky9pHwXtjXhV7f880VEMyR5pH+rmeMdEVG4BHlEROES\n", "5BERhUuQR0QULkEeEVG4BHlEROES5BERhUuQR0QULkEeEVG4BHlEROES5BERhUuQR0QULkEeEVG4\n", "BHlEROES5BERhUuQR0QULkEeEVG4BHlEROES5BERhUuQR0QULkEeEVG4BHlEROES5BERhUuQR0QU\n", "LkEeEVG4yU0XEGWR5KZrWBm21XQNEb2SII+VUFqWJ8Oj3TK0EhFRuAR5REThEuQREYVLkEdEFC5B\n", "HhFRuAR5REThEuQREYVLkEdEFC5BHhFRuFW6slPSfOAh4Algqe3dJG0InA1sAcwHDrH94CrWGRER\n", "o1jVI3IDM2zvbHu3etsHgYtsbwPMqR9HRESPdGNoZXgji/2BWfX9WcCBXdhHRESMohtH5BdLukrS\n", "0fW2qbYX1fcXAVNXcR8RETGGVe1+uIfteyQ9F7hI0k2dT9r26G1PZ3bcn1HfIiJiiKQZTCAcZXen\n", "JamkE4ElwNFU4+YLJW0CXGJ7u2GvdVmtULVC/azb/PnK+2ywon9/EasrSR7pZ3mlh1YkrS1p3fr+\n", "OsA+wPXAucCR9cuOBM5Z2X1ERMT4VmVoZSrwA0lD/50zbF8o6SpgtqR3UE8/XOUqIyJiVF0bWlmh\n", "nRb39TxDK0+9srjPBhlaibbo+tBKRESsHhLkERGFS5BHRBQuQR4RUbgEeURE4RLkERGFS5BHRBQu\n", "QR4RUbgEeURE4RLkERGFS5BHRBQuQR4RUbgEeURE4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ima4nuydBKRMtJ2gU4\n", "HDgEuAMoer3OeLoEeUQLSdqWKrwPBX4PfIfqG/iMJuuK3sjQSkQL1avM/wh4l+3f1dvuyBWd7ZST\n", "nRHt9HfAI8Blkk6V9CpADdcUPZIj8ogWq6/qPIBqmGUvqouBfmD7wkYLi65KkEcMiLoT4sHAYbaz\n", "1FuLJMgjIgqXMfKIiMIlyCMiCpcgj4goXII8IqJw/x8xxAHAVvo71wAAAABJRU5ErkJggg==\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "%matplotlib inline\n", "import matplotlib.pyplot as plt\n", "\n", "plt.bar(range(6), counts)\n", "plt.xticks(range(6), counts.index, rotation=\"vertical\")" ] }, { "cell_type": "code", "execution_count": 15, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "White 0.505353\n", "Black 0.289079\n", "Hispanic/Latino 0.143469\n", "Unknown 0.032120\n", "Asian/Pacific Islander 0.021413\n", "Native American 0.008565\n", "dtype: float64" ] }, "execution_count": 15, "metadata": {}, "output_type": "execute_result" } ], "source": [ "counts / sum(counts)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Racial breakdown\n", "\n", "It looks like people identified as `Black` are far overrepresented in the shootings versus in the population of the US (`28%` vs `16%`). You can see the breakdown of population by race [here](https://en.wikipedia.org/wiki/Race_and_ethnicity_in_the_United_States#Racial_makeup_of_the_U.S._population). \n", "\n", "People identified as `Hispanic` appear to be killed about as often as random chance would account for (`14%` of the people killed as Hispanic, versus `17%` of the overall population).\n", "\n", "Whites are underrepresented among shooting victims vs their population percentage, as are Asians." ] }, { "cell_type": "code", "execution_count": 22, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 22, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": [ "iVBORw0KGgoAAAANSUhEUgAAAYEAAAEACAYAAABVtcpZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\n", "AAALEgAACxIB0t1+/AA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FJWmIWAUlaYhYBSVpi\n", "FgFJWmL/H5jWl+1sWZOIAAAAAElFTkSuQmCC\n" ], "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "police_killings[\"p_income\"][police_killings[\"p_income\"] != \"-\"].astype(float).hist(bins=20)" ] }, { "cell_type": "code", "execution_count": 25, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "22348.0" ] }, "execution_count": 25, "metadata": {}, "output_type": "execute_result" } ], "source": [ "police_killings[\"p_income\"][police_killings[\"p_income\"] != \"-\"].astype(float).median()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Income breakdown\n", "\n", "According to the [Census](https://en.wikipedia.org/wiki/Personal_income_in_the_United_States), median personal income in the US is `28,567`, and our median is `22,348`, which means that shootings tend to happen in less affluent areas. Our sample size is relatively small, though, so it's hard to make sweeping conclusions." ] }, { "cell_type": "code", "execution_count": 29, "metadata": { "collapsed": false }, "outputs": [], "source": [ "state_pop = pd.read_csv(\"state_population.csv\")" ] }, { "cell_type": "code", "execution_count": 38, "metadata": { "collapsed": false }, "outputs": [], "source": [ "counts = police_killings[\"state_fp\"].value_counts()\n", "\n", "states = pd.DataFrame({\"STATE\": counts.index, \"shootings\": counts})" ] }, { "cell_type": "code", "execution_count": 41, "metadata": { "collapsed": false }, "outputs": [], "source": [ "states = states.merge(state_pop, on=\"STATE\")" ] }, { "cell_type": "code", "execution_count": 48, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/html": [ "
\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
STATEshootingsSUMLEVREGIONDIVISIONNAMEPOPESTIMATE2015POPEST18PLUS2015PCNT_POPEST18PLUSratepop_millions
43914011Connecticut3590886282682778.70.2784833.590886
224274012Pennsylvania128025031011222979.00.54676812.802503
381924024Iowa3123899239510376.70.6402263.123899
636134012New York197957911558497478.70.65670519.795791
292554011Massachusetts6794422540733579.60.7358986.794422
423314011New Hampshire1330608106661080.20.7515361.330608
452314011Maine1329328107294880.70.7522601.329328
1117114023Illinois12859995990132277.00.85536612.859995
1239104023Ohio11613423898494677.40.86107311.613423
315554023Wisconsin5771337447671177.60.8663505.771337
162694023Michigan9922576771527277.80.9070239.922576
284764036Tennessee6600299510268877.30.9090506.600299
1537104035North Carolina10042802775223477.20.99573810.042802
363234048Nevada2890845222168176.91.0377592.890845
185194035Virginia8382993651257177.71.0736028.382993
405424035West Virginia1844128146453279.41.0845231.844128
252764024Minnesota5489594420520776.61.0929775.489594
201884023Indiana6619680504022476.11.2085186.619680
834114012New Jersey8958013695919277.71.2279518.958013
35544037Arkansas2978204227290476.31.3430912.978204
212294035Florida202712721616614379.71.43059620.271272
441114035District of Columbia67222855412182.41.4875910.672228
953114049Washington7170351555850977.51.5340957.170351
513164035Georgia10214860771068875.51.56634610.214860
232174036Kentucky4425092341342577.11.5818884.425092
1329104024Missouri6083672469219677.11.6437446.083672
21184036Alabama4858979375548377.31.6464364.858979
1424104035Maryland6006401465817577.61.6648916.006401
304954048Utah2995919208342369.51.6689372.995919
465614048Wyoming58610744721276.31.7061730.586107
148474037Texas274691142025734373.71.71101327.469114
174594035South Carolina4896146380455877.71.8381804.896146
06744049California391448183002390276.71.89041639.144818
373024048Montana103294980652978.11.9362041.032949
194184049Oregon4028977316612178.61.9856164.028977
262864036Mississippi2992333226548575.72.0051242.992333
242064024Kansas2911641219208475.32.0606942.911641
411024035Delaware94593474154878.42.1143120.945934
78124048Colorado5456574419950977.02.1991825.456574
1022114037Louisiana4670724355591176.12.3550954.670724
323554048New Mexico2085109158820176.22.3979562.085109
331644048Idaho1654930122209373.82.4170211.654930
39224049Alaska73843255216674.82.7084420.738432
341544049Hawaii1431603112077078.32.7940711.431603
273164024Nebraska1896190142585375.23.1642401.896190
34254048Arizona6828065520521576.23.6613596.828065
440224037Oklahoma3911338295001775.45.6246743.911338
\n", "
" ], "text/plain": [ " STATE shootings SUMLEV REGION DIVISION NAME \\\n", "43 9 1 40 1 1 Connecticut \n", "22 42 7 40 1 2 Pennsylvania \n", "38 19 2 40 2 4 Iowa \n", "6 36 13 40 1 2 New York \n", "29 25 5 40 1 1 Massachusetts \n", "42 33 1 40 1 1 New Hampshire \n", "45 23 1 40 1 1 Maine \n", "11 17 11 40 2 3 Illinois \n", "12 39 10 40 2 3 Ohio \n", "31 55 5 40 2 3 Wisconsin \n", "16 26 9 40 2 3 Michigan \n", "28 47 6 40 3 6 Tennessee \n", "15 37 10 40 3 5 North Carolina \n", "36 32 3 40 4 8 Nevada \n", "18 51 9 40 3 5 Virginia \n", "40 54 2 40 3 5 West Virginia \n", "25 27 6 40 2 4 Minnesota \n", "20 18 8 40 2 3 Indiana \n", "8 34 11 40 1 2 New Jersey \n", "35 5 4 40 3 7 Arkansas \n", "2 12 29 40 3 5 Florida \n", "44 11 1 40 3 5 District of Columbia \n", "9 53 11 40 4 9 Washington \n", "5 13 16 40 3 5 Georgia \n", "23 21 7 40 3 6 Kentucky \n", "13 29 10 40 2 4 Missouri \n", "21 1 8 40 3 6 Alabama \n", "14 24 10 40 3 5 Maryland \n", "30 49 5 40 4 8 Utah \n", "46 56 1 40 4 8 Wyoming \n", "1 48 47 40 3 7 Texas \n", "17 45 9 40 3 5 South Carolina \n", "0 6 74 40 4 9 California \n", "37 30 2 40 4 8 Montana \n", "19 41 8 40 4 9 Oregon \n", "26 28 6 40 3 6 Mississippi \n", "24 20 6 40 2 4 Kansas \n", "41 10 2 40 3 5 Delaware \n", "7 8 12 40 4 8 Colorado \n", "10 22 11 40 3 7 Louisiana \n", "32 35 5 40 4 8 New Mexico \n", "33 16 4 40 4 8 Idaho \n", "39 2 2 40 4 9 Alaska \n", "34 15 4 40 4 9 Hawaii \n", "27 31 6 40 2 4 Nebraska \n", "3 4 25 40 4 8 Arizona \n", "4 40 22 40 3 7 Oklahoma \n", "\n", " POPESTIMATE2015 POPEST18PLUS2015 PCNT_POPEST18PLUS rate \\\n", "43 3590886 2826827 78.7 0.278483 \n", "22 12802503 10112229 79.0 0.546768 \n", "38 3123899 2395103 76.7 0.640226 \n", "6 19795791 15584974 78.7 0.656705 \n", "29 6794422 5407335 79.6 0.735898 \n", "42 1330608 1066610 80.2 0.751536 \n", "45 1329328 1072948 80.7 0.752260 \n", "11 12859995 9901322 77.0 0.855366 \n", "12 11613423 8984946 77.4 0.861073 \n", "31 5771337 4476711 77.6 0.866350 \n", "16 9922576 7715272 77.8 0.907023 \n", "28 6600299 5102688 77.3 0.909050 \n", "15 10042802 7752234 77.2 0.995738 \n", "36 2890845 2221681 76.9 1.037759 \n", "18 8382993 6512571 77.7 1.073602 \n", "40 1844128 1464532 79.4 1.084523 \n", "25 5489594 4205207 76.6 1.092977 \n", "20 6619680 5040224 76.1 1.208518 \n", "8 8958013 6959192 77.7 1.227951 \n", "35 2978204 2272904 76.3 1.343091 \n", "2 20271272 16166143 79.7 1.430596 \n", "44 672228 554121 82.4 1.487591 \n", "9 7170351 5558509 77.5 1.534095 \n", "5 10214860 7710688 75.5 1.566346 \n", "23 4425092 3413425 77.1 1.581888 \n", "13 6083672 4692196 77.1 1.643744 \n", "21 4858979 3755483 77.3 1.646436 \n", "14 6006401 4658175 77.6 1.664891 \n", "30 2995919 2083423 69.5 1.668937 \n", "46 586107 447212 76.3 1.706173 \n", "1 27469114 20257343 73.7 1.711013 \n", "17 4896146 3804558 77.7 1.838180 \n", "0 39144818 30023902 76.7 1.890416 \n", "37 1032949 806529 78.1 1.936204 \n", "19 4028977 3166121 78.6 1.985616 \n", "26 2992333 2265485 75.7 2.005124 \n", "24 2911641 2192084 75.3 2.060694 \n", "41 945934 741548 78.4 2.114312 \n", "7 5456574 4199509 77.0 2.199182 \n", "10 4670724 3555911 76.1 2.355095 \n", "32 2085109 1588201 76.2 2.397956 \n", "33 1654930 1222093 73.8 2.417021 \n", "39 738432 552166 74.8 2.708442 \n", "34 1431603 1120770 78.3 2.794071 \n", "27 1896190 1425853 75.2 3.164240 \n", "3 6828065 5205215 76.2 3.661359 \n", "4 3911338 2950017 75.4 5.624674 \n", "\n", " pop_millions \n", "43 3.590886 \n", "22 12.802503 \n", "38 3.123899 \n", "6 19.795791 \n", "29 6.794422 \n", "42 1.330608 \n", "45 1.329328 \n", "11 12.859995 \n", "12 11.613423 \n", "31 5.771337 \n", "16 9.922576 \n", "28 6.600299 \n", "15 10.042802 \n", "36 2.890845 \n", "18 8.382993 \n", "40 1.844128 \n", "25 5.489594 \n", "20 6.619680 \n", "8 8.958013 \n", "35 2.978204 \n", "2 20.271272 \n", "44 0.672228 \n", "9 7.170351 \n", "5 10.214860 \n", "23 4.425092 \n", "13 6.083672 \n", "21 4.858979 \n", "14 6.006401 \n", "30 2.995919 \n", "46 0.586107 \n", "1 27.469114 \n", "17 4.896146 \n", "0 39.144818 \n", "37 1.032949 \n", "19 4.028977 \n", "26 2.992333 \n", "24 2.911641 \n", "41 0.945934 \n", "7 5.456574 \n", "10 4.670724 \n", "32 2.085109 \n", "33 1.654930 \n", "39 0.738432 \n", "34 1.431603 \n", "27 1.896190 \n", "3 6.828065 \n", "4 3.911338 " ] }, "execution_count": 48, "metadata": {}, "output_type": "execute_result" } ], "source": [ "states[\"pop_millions\"] = states[\"POPESTIMATE2015\"] / 1000000\n", "states[\"rate\"] = states[\"shootings\"] / states[\"pop_millions\"]\n", "\n", "states.sort(\"rate\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Killings by state\n", "\n", "States in the midwest and south seem to have the highest police killing rates, whereas those in the northeast seem to have the lowest." ] }, { "cell_type": "code", "execution_count": 50, "metadata": { "collapsed": false, "scrolled": true }, "outputs": [ { "data": { "text/plain": [ "CA 74\n", "TX 46\n", "FL 29\n", "AZ 25\n", "OK 22\n", "GA 16\n", "NY 14\n", "CO 12\n", "LA 11\n", "WA 11\n", "IL 11\n", "NJ 11\n", "MO 10\n", "MD 10\n", "OH 10\n", "NC 10\n", "VA 9\n", "SC 9\n", "MI 9\n", "AL 8\n", "OR 8\n", "IN 8\n", "PA 7\n", "KY 7\n", "MS 6\n", "KS 6\n", "NE 6\n", "TN 6\n", "MN 6\n", "UT 5\n", "MA 5\n", "WI 5\n", "NM 5\n", "ID 4\n", "HI 4\n", "AR 4\n", "NV 3\n", "MT 2\n", "AK 2\n", "DE 2\n", "WV 2\n", "IA 2\n", "DC 1\n", "CT 1\n", "NH 1\n", "WY 1\n", "ME 1\n", "dtype: int64" ] }, "execution_count": 50, "metadata": {}, "output_type": "execute_result" } ], "source": [ "police_killings[\"state\"].value_counts()" ] }, { "cell_type": "code", "execution_count": 66, "metadata": { "collapsed": false }, "outputs": [ { "name": "stderr", "output_type": "stream", "text": [ "/Users/vik/python_envs/dscontent/lib/python3.4/site-packages/IPython/kernel/__main__.py:7: SettingWithCopyWarning: \n", "A value is trying to be set on a copy of a slice from a DataFrame.\n", "Try using .loc[row_indexer,col_indexer] = value instead\n", "\n", "See the the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n", "/Users/vik/python_envs/dscontent/lib/python3.4/site-packages/IPython/kernel/__main__.py:8: SettingWithCopyWarning: \n", "A value is trying to be set on a copy of a slice from a DataFrame.\n", "Try using .loc[row_indexer,col_indexer] = value instead\n", "\n", "See the the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n", "/Users/vik/python_envs/dscontent/lib/python3.4/site-packages/IPython/kernel/__main__.py:9: SettingWithCopyWarning: \n", "A value is trying to be set on a copy of a slice from a DataFrame.\n", "Try using .loc[row_indexer,col_indexer] = value instead\n", "\n", "See the the caveats in the documentation: http://pandas.pydata.org/pandas-docs/stable/indexing.html#indexing-view-versus-copy\n" ] } ], "source": [ "pk = police_killings[\n", " (police_killings[\"share_white\"] != \"-\") & \n", " (police_killings[\"share_black\"] != \"-\") & \n", " (police_killings[\"share_hispanic\"] != \"-\")\n", "]\n", "\n", "pk[\"share_white\"] = pk[\"share_white\"].astype(float)\n", "pk[\"share_black\"] = pk[\"share_black\"].astype(float)\n", "pk[\"share_hispanic\"] = pk[\"share_hispanic\"].astype(float)" ] }, { "cell_type": "code", "execution_count": 67, "metadata": { "collapsed": false }, "outputs": [], "source": [ "lowest_states = [\"CT\", \"PA\", \"IA\", \"NY\", \"MA\", \"NH\", \"ME\", \"IL\", \"OH\", \"WI\"]\n", "highest_states = [\"OK\", \"AZ\", \"NE\", \"HI\", \"AK\", \"ID\", \"NM\", \"LA\", \"CO\", \"DE\"]\n", "\n", "ls = pk[pk[\"state\"].isin(lowest_states)]\n", "hs = pk[pk[\"state\"].isin(highest_states)]" ] }, { "cell_type": "code", "execution_count": 68, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "pop 4201.660714\n", "county_income 54830.839286\n", "share_white 60.616071\n", "share_black 21.257143\n", "share_hispanic 12.948214\n", "dtype: float64" ] }, "execution_count": 68, "metadata": {}, "output_type": "execute_result" } ], "source": [ "columns = [\"pop\", \"county_income\", \"share_white\", \"share_black\", \"share_hispanic\"]\n", "\n", "ls[columns].mean()" ] }, { "cell_type": "code", "execution_count": 69, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "pop 4315.750000\n", "county_income 48706.967391\n", "share_white 55.652174\n", "share_black 11.532609\n", "share_hispanic 20.693478\n", "dtype: float64" ] }, "execution_count": 69, "metadata": {}, "output_type": "execute_result" } ], "source": [ "hs[columns].mean()" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## State by state rates\n", "\n", "It looks like the states with low rates of shootings tend to have a higher proportion of blacks in the population, and a lower proportion of hispanics in the census regions where the shootings occur. It looks like the income of the counties where the shootings occur is higher.\n", "\n", "States with high rates of shootings tend to have high hispanic population shares in the counties where shootings occur." ] } ], "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.4.2" } }, "nbformat": 4, "nbformat_minor": 0 }