{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>name</th>\n",
       "      <th>age</th>\n",
       "      <th>gender</th>\n",
       "      <th>raceethnicity</th>\n",
       "      <th>month</th>\n",
       "      <th>day</th>\n",
       "      <th>year</th>\n",
       "      <th>streetaddress</th>\n",
       "      <th>city</th>\n",
       "      <th>state</th>\n",
       "      <th>...</th>\n",
       "      <th>share_hispanic</th>\n",
       "      <th>p_income</th>\n",
       "      <th>h_income</th>\n",
       "      <th>county_income</th>\n",
       "      <th>comp_income</th>\n",
       "      <th>county_bucket</th>\n",
       "      <th>nat_bucket</th>\n",
       "      <th>pov</th>\n",
       "      <th>urate</th>\n",
       "      <th>college</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>A'donte Washington</td>\n",
       "      <td>16</td>\n",
       "      <td>Male</td>\n",
       "      <td>Black</td>\n",
       "      <td>February</td>\n",
       "      <td>23</td>\n",
       "      <td>2015</td>\n",
       "      <td>Clearview Ln</td>\n",
       "      <td>Millbrook</td>\n",
       "      <td>AL</td>\n",
       "      <td>...</td>\n",
       "      <td>5.6</td>\n",
       "      <td>28375</td>\n",
       "      <td>51367</td>\n",
       "      <td>54766</td>\n",
       "      <td>0.937936</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>14.1</td>\n",
       "      <td>0.097686</td>\n",
       "      <td>0.168510</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>Aaron Rutledge</td>\n",
       "      <td>27</td>\n",
       "      <td>Male</td>\n",
       "      <td>White</td>\n",
       "      <td>April</td>\n",
       "      <td>2</td>\n",
       "      <td>2015</td>\n",
       "      <td>300 block Iris Park Dr</td>\n",
       "      <td>Pineville</td>\n",
       "      <td>LA</td>\n",
       "      <td>...</td>\n",
       "      <td>0.5</td>\n",
       "      <td>14678</td>\n",
       "      <td>27972</td>\n",
       "      <td>40930</td>\n",
       "      <td>0.683411</td>\n",
       "      <td>2</td>\n",
       "      <td>1</td>\n",
       "      <td>28.8</td>\n",
       "      <td>0.065724</td>\n",
       "      <td>0.111402</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Aaron Siler</td>\n",
       "      <td>26</td>\n",
       "      <td>Male</td>\n",
       "      <td>White</td>\n",
       "      <td>March</td>\n",
       "      <td>14</td>\n",
       "      <td>2015</td>\n",
       "      <td>22nd Ave and 56th St</td>\n",
       "      <td>Kenosha</td>\n",
       "      <td>WI</td>\n",
       "      <td>...</td>\n",
       "      <td>16.8</td>\n",
       "      <td>25286</td>\n",
       "      <td>45365</td>\n",
       "      <td>54930</td>\n",
       "      <td>0.825869</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>14.6</td>\n",
       "      <td>0.166293</td>\n",
       "      <td>0.147312</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Aaron Valdez</td>\n",
       "      <td>25</td>\n",
       "      <td>Male</td>\n",
       "      <td>Hispanic/Latino</td>\n",
       "      <td>March</td>\n",
       "      <td>11</td>\n",
       "      <td>2015</td>\n",
       "      <td>3000 Seminole Ave</td>\n",
       "      <td>South Gate</td>\n",
       "      <td>CA</td>\n",
       "      <td>...</td>\n",
       "      <td>98.8</td>\n",
       "      <td>17194</td>\n",
       "      <td>48295</td>\n",
       "      <td>55909</td>\n",
       "      <td>0.863814</td>\n",
       "      <td>3</td>\n",
       "      <td>3</td>\n",
       "      <td>11.7</td>\n",
       "      <td>0.124827</td>\n",
       "      <td>0.050133</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Adam Jovicic</td>\n",
       "      <td>29</td>\n",
       "      <td>Male</td>\n",
       "      <td>White</td>\n",
       "      <td>March</td>\n",
       "      <td>19</td>\n",
       "      <td>2015</td>\n",
       "      <td>364 Hiwood Ave</td>\n",
       "      <td>Munroe Falls</td>\n",
       "      <td>OH</td>\n",
       "      <td>...</td>\n",
       "      <td>1.7</td>\n",
       "      <td>33954</td>\n",
       "      <td>68785</td>\n",
       "      <td>49669</td>\n",
       "      <td>1.384868</td>\n",
       "      <td>5</td>\n",
       "      <td>4</td>\n",
       "      <td>1.9</td>\n",
       "      <td>0.063550</td>\n",
       "      <td>0.403954</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 34 columns</p>\n",
       "</div>"
      ],
      "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": {},
   "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": {},
   "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": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "([<matplotlib.axis.XTick at 0x10800db70>,\n",
       "  <matplotlib.axis.XTick at 0x10809f4e0>,\n",
       "  <matplotlib.axis.XTick at 0x106a85748>,\n",
       "  <matplotlib.axis.XTick at 0x106b67128>,\n",
       "  <matplotlib.axis.XTick at 0x106b67b38>,\n",
       "  <matplotlib.axis.XTick at 0x106b6a588>],\n",
       " <a list of 6 Text xticklabel objects>)"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXIAAAFgCAYAAACmOvKZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAH+ZJREFUeJzt3XnYXHV9/vH3bQIKBATEhi0CVrZUZFFQRGrAFnBjqcgi\nKoo/ai9+FsS6Yauk2KpV4XIXWxGjAhI3BPuTLQVRQFMQBAyrECVAgiBIgiAB7t8f5zxk8vBsSWbm\n5Hvmfl3XXJk5M8P5DHlyP2e+53s+X9kmIiLK9YymC4iIiFWTII+IKFyCPCKicAnyiIjCJcgjIgqX\nII+IKNyYQS5pmqRLJP1a0g2Sjq23z5S0QNI19e3VHe85QdKtkm6StE+vP0BExKDTWPPIJW0MbGz7\nWklTgKuBA4FDgMW2Txn2+unAmcCuwGbAxcA2tp/sUf0REQNvzCNy2wttX1vfXwLcSBXQABrhLQcA\nZ9leans+cBuwW/fKjYiI4SY8Ri5pS2Bn4Of1pn+U9CtJp0lav962KbCg420LWBb8ERHRA5Mn8qJ6\nWOW7wHG2l0j6MnBS/fRHgZOBd4zy9qeN3UhKX4CIiJVg+2mjIeMGuaQ1gO8B37J9Tv0furfj+a8C\n59UP7wKmdbx983rbhIppC0kzbc9suo5eaPNng3y+0g3A5xvxIHi8WSsCTgPm2f5Mx/ZNOl52EHB9\nff9c4DBJa0raCtgamLsqhUdExNjGOyLfA3gzcJ2ka+ptHwIOl7QT1bDJHcA7AWzPkzQbmAc8Dhzj\ntFeMiOipMacf9mynkls+tDLD9qVN19ELbf5skM9XugH4fCNmZ4I8IqIQo2VnLtGPiChcgjwionAJ\n8oiIwiXIIyIKlyCPiChcgjwionAJ8oiIwk2oaVYvlNY4K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2\nTk3XEb2VxZcj2u1Hkl7bdBHRWzkij2ix+sKutVl+GGLghh7aLkEeEVG4zFqJaDlJGwBbs/ziy5c1\nV1F0W4I8osUkHU11scw04BrgZcCVVBcGRUvkZGdEux0H7AbMt70XsDPwx2ZLim5LkEe026O2HwGQ\n9Ky6gda2DdcUXZahlYh2u7MeIz8HuEjSA8D8ZkuKbsuslYgBIWkG1cIL59t+bJyXR0ES5BEtJGk9\n2w9J2nCk523/od81Re8kyCNaSNJ/236tpPk8vW83trfqf1XRKwnyiIjCZdZKRItJ2kPSlPr+WySd\n0rGeZ7REgjyi3U4F/iRpR+A9wO1UizBEiyTII9rtcdtPAgcCX7T9BWDdhmuKLss88oh2WyzpQ8Cb\ngT3r9TvXaLim6LIckUe026HAn4GjbC8ENgM+1WxJ0W2ZtRIxQCTtCRxu+5ima4nuydBKRMtJ2gU4\nHDgEuAMoer3OeLoEeUQLSdqWKrwPBX4PfIfqG/iMJuuK3sjQSkQL1avM/wh4l+3f1dvuyBWd7ZST\nnRHt9HfAI8Blkk6V9CpADdcUPZIj8ogWq6/qPIBqmGUvqouBfmD7wkYLi65KkEcMiLoT4sHAYbaz\n1FuLJMgjIgqXMfKIiMIlyCMiCpcgj4goXII8IqJw/x8xxAHAVvo71wAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x108001080>"
      ]
     },
     "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": {},
   "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 highly over-represented in the shootings compared to the rest of the population of the U.S. (`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",
    "White people are underrepresented among shooting victims in regards to their population percentage, as are Asian people."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "<matplotlib.axes._subplots.AxesSubplot at 0x107f797f0>"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    },
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAYEAAAEACAYAAABVtcpZAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAGAJJREFUeJzt3X+sZGd93/H3F6+xwaZeNlbXxjZch8QBA7VDA3ZbqNfE\nUJckgKIIGymWXZr8Q1JwKgG7pGrzTyl2FcVNKlQpidkVAgeHgIvVNPXi7EmQQjEULxjbi3HDCtvJ\nrh1gXRqpio2//eM81zu+M3t37vx6nnvn/ZJG95wz88x89pzZ+c483zP3RmYiSVpOz6sdQJJUj0VA\nkpaYRUCSlphFQJKWmEVAkpaYRUCSlti6RSAibo2IoxFx38C2/xgRD0bE1yLiMxFx1sB1eyLiWxFx\nKCLeMs/gkqTpneyTwMeAq9dsuwt4VWZeAjwE7AGIiIuBa4CLy5iPRoSfNCSpYeu+SGfmF4Dvr9m2\nPzOfKatfAs4vy28HbsvMpzLzMPAw8PrZxpUkzdK079TfDfxxWX4J8OjAdY8C5015/5KkOZq4CETE\nrwN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JkX\nZOaF9NMJf5qZ11XeTy+MiBeV5TPo57rvq7yfjgCPRMRFZdNV9Ge/3Fkr0xrv4vhU0Nr7WnSuQ8Dl\nEfGCcl9X0Z9NVXVfRcTfLz9fCvw8/VlL9fbTeg2DWV/o3yV8k77DvWcO938b/dzf39HPif0L+ubQ\n5xl96tWHSpZDwD8b2L566tXDwG8PbD8NuJ3jp16tjJHpDfRz3Ac5fvrc1TVzAa8BvloyfR14fx5v\npFXbVwNjr+D42UE199OFZR8dpJ/L3VM7UxlzCX0z/2v0727Pqp2pjDsD+BvgRQPbau+rD3D8FNF9\n9GfZ1M705yXTQeDK2vvJL4tJ0hJb5HSQJKkxFgFJWmIWAUlaYhYBSVpiFgFJWmIWAUlaYhYBSVpi\nFgFJWmL/H5jWl+1sWZOIAAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x10824f0b8>"
      ]
     },
     "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": {},
   "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 U.S. is `28,567`, and the median income is `22,348`, which means that shootings tend to happen in less-affluent areas. Our sample size is relatively small, however, so it's difficult to make sweeping conclusions."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [],
   "source": [
    "state_pop = pd.read_csv(\"state_population.csv\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "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": {},
   "outputs": [],
   "source": [
    "states = states.merge(state_pop, on=\"STATE\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div style=\"max-height:1000px;max-width:1500px;overflow:auto;\">\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>STATE</th>\n",
       "      <th>shootings</th>\n",
       "      <th>SUMLEV</th>\n",
       "      <th>REGION</th>\n",
       "      <th>DIVISION</th>\n",
       "      <th>NAME</th>\n",
       "      <th>POPESTIMATE2015</th>\n",
       "      <th>POPEST18PLUS2015</th>\n",
       "      <th>PCNT_POPEST18PLUS</th>\n",
       "      <th>rate</th>\n",
       "      <th>pop_millions</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>43</th>\n",
       "      <td>9</td>\n",
       "      <td>1</td>\n",
       "      <td>40</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Connecticut</td>\n",
       "      <td>3590886</td>\n",
       "      <td>2826827</td>\n",
       "      <td>78.7</td>\n",
       "      <td>0.278483</td>\n",
       "      <td>3.590886</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>22</th>\n",
       "      <td>42</td>\n",
       "      <td>7</td>\n",
       "      <td>40</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>Pennsylvania</td>\n",
       "      <td>12802503</td>\n",
       "      <td>10112229</td>\n",
       "      <td>79.0</td>\n",
       "      <td>0.546768</td>\n",
       "      <td>12.802503</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>38</th>\n",
       "      <td>19</td>\n",
       "      <td>2</td>\n",
       "      <td>40</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "      <td>Iowa</td>\n",
       "      <td>3123899</td>\n",
       "      <td>2395103</td>\n",
       "      <td>76.7</td>\n",
       "      <td>0.640226</td>\n",
       "      <td>3.123899</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>6</th>\n",
       "      <td>36</td>\n",
       "      <td>13</td>\n",
       "      <td>40</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>New York</td>\n",
       "      <td>19795791</td>\n",
       "      <td>15584974</td>\n",
       "      <td>78.7</td>\n",
       "      <td>0.656705</td>\n",
       "      <td>19.795791</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>29</th>\n",
       "      <td>25</td>\n",
       "      <td>5</td>\n",
       "      <td>40</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Massachusetts</td>\n",
       "      <td>6794422</td>\n",
       "      <td>5407335</td>\n",
       "      <td>79.6</td>\n",
       "      <td>0.735898</td>\n",
       "      <td>6.794422</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>42</th>\n",
       "      <td>33</td>\n",
       "      <td>1</td>\n",
       "      <td>40</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>New Hampshire</td>\n",
       "      <td>1330608</td>\n",
       "      <td>1066610</td>\n",
       "      <td>80.2</td>\n",
       "      <td>0.751536</td>\n",
       "      <td>1.330608</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>45</th>\n",
       "      <td>23</td>\n",
       "      <td>1</td>\n",
       "      <td>40</td>\n",
       "      <td>1</td>\n",
       "      <td>1</td>\n",
       "      <td>Maine</td>\n",
       "      <td>1329328</td>\n",
       "      <td>1072948</td>\n",
       "      <td>80.7</td>\n",
       "      <td>0.752260</td>\n",
       "      <td>1.329328</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>11</th>\n",
       "      <td>17</td>\n",
       "      <td>11</td>\n",
       "      <td>40</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>Illinois</td>\n",
       "      <td>12859995</td>\n",
       "      <td>9901322</td>\n",
       "      <td>77.0</td>\n",
       "      <td>0.855366</td>\n",
       "      <td>12.859995</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>12</th>\n",
       "      <td>39</td>\n",
       "      <td>10</td>\n",
       "      <td>40</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>Ohio</td>\n",
       "      <td>11613423</td>\n",
       "      <td>8984946</td>\n",
       "      <td>77.4</td>\n",
       "      <td>0.861073</td>\n",
       "      <td>11.613423</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>31</th>\n",
       "      <td>55</td>\n",
       "      <td>5</td>\n",
       "      <td>40</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>Wisconsin</td>\n",
       "      <td>5771337</td>\n",
       "      <td>4476711</td>\n",
       "      <td>77.6</td>\n",
       "      <td>0.866350</td>\n",
       "      <td>5.771337</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>16</th>\n",
       "      <td>26</td>\n",
       "      <td>9</td>\n",
       "      <td>40</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>Michigan</td>\n",
       "      <td>9922576</td>\n",
       "      <td>7715272</td>\n",
       "      <td>77.8</td>\n",
       "      <td>0.907023</td>\n",
       "      <td>9.922576</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>28</th>\n",
       "      <td>47</td>\n",
       "      <td>6</td>\n",
       "      <td>40</td>\n",
       "      <td>3</td>\n",
       "      <td>6</td>\n",
       "      <td>Tennessee</td>\n",
       "      <td>6600299</td>\n",
       "      <td>5102688</td>\n",
       "      <td>77.3</td>\n",
       "      <td>0.909050</td>\n",
       "      <td>6.600299</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>15</th>\n",
       "      <td>37</td>\n",
       "      <td>10</td>\n",
       "      <td>40</td>\n",
       "      <td>3</td>\n",
       "      <td>5</td>\n",
       "      <td>North Carolina</td>\n",
       "      <td>10042802</td>\n",
       "      <td>7752234</td>\n",
       "      <td>77.2</td>\n",
       "      <td>0.995738</td>\n",
       "      <td>10.042802</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>36</th>\n",
       "      <td>32</td>\n",
       "      <td>3</td>\n",
       "      <td>40</td>\n",
       "      <td>4</td>\n",
       "      <td>8</td>\n",
       "      <td>Nevada</td>\n",
       "      <td>2890845</td>\n",
       "      <td>2221681</td>\n",
       "      <td>76.9</td>\n",
       "      <td>1.037759</td>\n",
       "      <td>2.890845</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>18</th>\n",
       "      <td>51</td>\n",
       "      <td>9</td>\n",
       "      <td>40</td>\n",
       "      <td>3</td>\n",
       "      <td>5</td>\n",
       "      <td>Virginia</td>\n",
       "      <td>8382993</td>\n",
       "      <td>6512571</td>\n",
       "      <td>77.7</td>\n",
       "      <td>1.073602</td>\n",
       "      <td>8.382993</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>40</th>\n",
       "      <td>54</td>\n",
       "      <td>2</td>\n",
       "      <td>40</td>\n",
       "      <td>3</td>\n",
       "      <td>5</td>\n",
       "      <td>West Virginia</td>\n",
       "      <td>1844128</td>\n",
       "      <td>1464532</td>\n",
       "      <td>79.4</td>\n",
       "      <td>1.084523</td>\n",
       "      <td>1.844128</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>25</th>\n",
       "      <td>27</td>\n",
       "      <td>6</td>\n",
       "      <td>40</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "      <td>Minnesota</td>\n",
       "      <td>5489594</td>\n",
       "      <td>4205207</td>\n",
       "      <td>76.6</td>\n",
       "      <td>1.092977</td>\n",
       "      <td>5.489594</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>20</th>\n",
       "      <td>18</td>\n",
       "      <td>8</td>\n",
       "      <td>40</td>\n",
       "      <td>2</td>\n",
       "      <td>3</td>\n",
       "      <td>Indiana</td>\n",
       "      <td>6619680</td>\n",
       "      <td>5040224</td>\n",
       "      <td>76.1</td>\n",
       "      <td>1.208518</td>\n",
       "      <td>6.619680</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>8</th>\n",
       "      <td>34</td>\n",
       "      <td>11</td>\n",
       "      <td>40</td>\n",
       "      <td>1</td>\n",
       "      <td>2</td>\n",
       "      <td>New Jersey</td>\n",
       "      <td>8958013</td>\n",
       "      <td>6959192</td>\n",
       "      <td>77.7</td>\n",
       "      <td>1.227951</td>\n",
       "      <td>8.958013</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>35</th>\n",
       "      <td>5</td>\n",
       "      <td>4</td>\n",
       "      <td>40</td>\n",
       "      <td>3</td>\n",
       "      <td>7</td>\n",
       "      <td>Arkansas</td>\n",
       "      <td>2978204</td>\n",
       "      <td>2272904</td>\n",
       "      <td>76.3</td>\n",
       "      <td>1.343091</td>\n",
       "      <td>2.978204</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>12</td>\n",
       "      <td>29</td>\n",
       "      <td>40</td>\n",
       "      <td>3</td>\n",
       "      <td>5</td>\n",
       "      <td>Florida</td>\n",
       "      <td>20271272</td>\n",
       "      <td>16166143</td>\n",
       "      <td>79.7</td>\n",
       "      <td>1.430596</td>\n",
       "      <td>20.271272</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>44</th>\n",
       "      <td>11</td>\n",
       "      <td>1</td>\n",
       "      <td>40</td>\n",
       "      <td>3</td>\n",
       "      <td>5</td>\n",
       "      <td>District of Columbia</td>\n",
       "      <td>672228</td>\n",
       "      <td>554121</td>\n",
       "      <td>82.4</td>\n",
       "      <td>1.487591</td>\n",
       "      <td>0.672228</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>9</th>\n",
       "      <td>53</td>\n",
       "      <td>11</td>\n",
       "      <td>40</td>\n",
       "      <td>4</td>\n",
       "      <td>9</td>\n",
       "      <td>Washington</td>\n",
       "      <td>7170351</td>\n",
       "      <td>5558509</td>\n",
       "      <td>77.5</td>\n",
       "      <td>1.534095</td>\n",
       "      <td>7.170351</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>5</th>\n",
       "      <td>13</td>\n",
       "      <td>16</td>\n",
       "      <td>40</td>\n",
       "      <td>3</td>\n",
       "      <td>5</td>\n",
       "      <td>Georgia</td>\n",
       "      <td>10214860</td>\n",
       "      <td>7710688</td>\n",
       "      <td>75.5</td>\n",
       "      <td>1.566346</td>\n",
       "      <td>10.214860</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>23</th>\n",
       "      <td>21</td>\n",
       "      <td>7</td>\n",
       "      <td>40</td>\n",
       "      <td>3</td>\n",
       "      <td>6</td>\n",
       "      <td>Kentucky</td>\n",
       "      <td>4425092</td>\n",
       "      <td>3413425</td>\n",
       "      <td>77.1</td>\n",
       "      <td>1.581888</td>\n",
       "      <td>4.425092</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>13</th>\n",
       "      <td>29</td>\n",
       "      <td>10</td>\n",
       "      <td>40</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "      <td>Missouri</td>\n",
       "      <td>6083672</td>\n",
       "      <td>4692196</td>\n",
       "      <td>77.1</td>\n",
       "      <td>1.643744</td>\n",
       "      <td>6.083672</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>21</th>\n",
       "      <td>1</td>\n",
       "      <td>8</td>\n",
       "      <td>40</td>\n",
       "      <td>3</td>\n",
       "      <td>6</td>\n",
       "      <td>Alabama</td>\n",
       "      <td>4858979</td>\n",
       "      <td>3755483</td>\n",
       "      <td>77.3</td>\n",
       "      <td>1.646436</td>\n",
       "      <td>4.858979</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>14</th>\n",
       "      <td>24</td>\n",
       "      <td>10</td>\n",
       "      <td>40</td>\n",
       "      <td>3</td>\n",
       "      <td>5</td>\n",
       "      <td>Maryland</td>\n",
       "      <td>6006401</td>\n",
       "      <td>4658175</td>\n",
       "      <td>77.6</td>\n",
       "      <td>1.664891</td>\n",
       "      <td>6.006401</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>30</th>\n",
       "      <td>49</td>\n",
       "      <td>5</td>\n",
       "      <td>40</td>\n",
       "      <td>4</td>\n",
       "      <td>8</td>\n",
       "      <td>Utah</td>\n",
       "      <td>2995919</td>\n",
       "      <td>2083423</td>\n",
       "      <td>69.5</td>\n",
       "      <td>1.668937</td>\n",
       "      <td>2.995919</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>46</th>\n",
       "      <td>56</td>\n",
       "      <td>1</td>\n",
       "      <td>40</td>\n",
       "      <td>4</td>\n",
       "      <td>8</td>\n",
       "      <td>Wyoming</td>\n",
       "      <td>586107</td>\n",
       "      <td>447212</td>\n",
       "      <td>76.3</td>\n",
       "      <td>1.706173</td>\n",
       "      <td>0.586107</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>48</td>\n",
       "      <td>47</td>\n",
       "      <td>40</td>\n",
       "      <td>3</td>\n",
       "      <td>7</td>\n",
       "      <td>Texas</td>\n",
       "      <td>27469114</td>\n",
       "      <td>20257343</td>\n",
       "      <td>73.7</td>\n",
       "      <td>1.711013</td>\n",
       "      <td>27.469114</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>17</th>\n",
       "      <td>45</td>\n",
       "      <td>9</td>\n",
       "      <td>40</td>\n",
       "      <td>3</td>\n",
       "      <td>5</td>\n",
       "      <td>South Carolina</td>\n",
       "      <td>4896146</td>\n",
       "      <td>3804558</td>\n",
       "      <td>77.7</td>\n",
       "      <td>1.838180</td>\n",
       "      <td>4.896146</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>6</td>\n",
       "      <td>74</td>\n",
       "      <td>40</td>\n",
       "      <td>4</td>\n",
       "      <td>9</td>\n",
       "      <td>California</td>\n",
       "      <td>39144818</td>\n",
       "      <td>30023902</td>\n",
       "      <td>76.7</td>\n",
       "      <td>1.890416</td>\n",
       "      <td>39.144818</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>37</th>\n",
       "      <td>30</td>\n",
       "      <td>2</td>\n",
       "      <td>40</td>\n",
       "      <td>4</td>\n",
       "      <td>8</td>\n",
       "      <td>Montana</td>\n",
       "      <td>1032949</td>\n",
       "      <td>806529</td>\n",
       "      <td>78.1</td>\n",
       "      <td>1.936204</td>\n",
       "      <td>1.032949</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>19</th>\n",
       "      <td>41</td>\n",
       "      <td>8</td>\n",
       "      <td>40</td>\n",
       "      <td>4</td>\n",
       "      <td>9</td>\n",
       "      <td>Oregon</td>\n",
       "      <td>4028977</td>\n",
       "      <td>3166121</td>\n",
       "      <td>78.6</td>\n",
       "      <td>1.985616</td>\n",
       "      <td>4.028977</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>26</th>\n",
       "      <td>28</td>\n",
       "      <td>6</td>\n",
       "      <td>40</td>\n",
       "      <td>3</td>\n",
       "      <td>6</td>\n",
       "      <td>Mississippi</td>\n",
       "      <td>2992333</td>\n",
       "      <td>2265485</td>\n",
       "      <td>75.7</td>\n",
       "      <td>2.005124</td>\n",
       "      <td>2.992333</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>24</th>\n",
       "      <td>20</td>\n",
       "      <td>6</td>\n",
       "      <td>40</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "      <td>Kansas</td>\n",
       "      <td>2911641</td>\n",
       "      <td>2192084</td>\n",
       "      <td>75.3</td>\n",
       "      <td>2.060694</td>\n",
       "      <td>2.911641</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>41</th>\n",
       "      <td>10</td>\n",
       "      <td>2</td>\n",
       "      <td>40</td>\n",
       "      <td>3</td>\n",
       "      <td>5</td>\n",
       "      <td>Delaware</td>\n",
       "      <td>945934</td>\n",
       "      <td>741548</td>\n",
       "      <td>78.4</td>\n",
       "      <td>2.114312</td>\n",
       "      <td>0.945934</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>7</th>\n",
       "      <td>8</td>\n",
       "      <td>12</td>\n",
       "      <td>40</td>\n",
       "      <td>4</td>\n",
       "      <td>8</td>\n",
       "      <td>Colorado</td>\n",
       "      <td>5456574</td>\n",
       "      <td>4199509</td>\n",
       "      <td>77.0</td>\n",
       "      <td>2.199182</td>\n",
       "      <td>5.456574</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>10</th>\n",
       "      <td>22</td>\n",
       "      <td>11</td>\n",
       "      <td>40</td>\n",
       "      <td>3</td>\n",
       "      <td>7</td>\n",
       "      <td>Louisiana</td>\n",
       "      <td>4670724</td>\n",
       "      <td>3555911</td>\n",
       "      <td>76.1</td>\n",
       "      <td>2.355095</td>\n",
       "      <td>4.670724</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>32</th>\n",
       "      <td>35</td>\n",
       "      <td>5</td>\n",
       "      <td>40</td>\n",
       "      <td>4</td>\n",
       "      <td>8</td>\n",
       "      <td>New Mexico</td>\n",
       "      <td>2085109</td>\n",
       "      <td>1588201</td>\n",
       "      <td>76.2</td>\n",
       "      <td>2.397956</td>\n",
       "      <td>2.085109</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>33</th>\n",
       "      <td>16</td>\n",
       "      <td>4</td>\n",
       "      <td>40</td>\n",
       "      <td>4</td>\n",
       "      <td>8</td>\n",
       "      <td>Idaho</td>\n",
       "      <td>1654930</td>\n",
       "      <td>1222093</td>\n",
       "      <td>73.8</td>\n",
       "      <td>2.417021</td>\n",
       "      <td>1.654930</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>39</th>\n",
       "      <td>2</td>\n",
       "      <td>2</td>\n",
       "      <td>40</td>\n",
       "      <td>4</td>\n",
       "      <td>9</td>\n",
       "      <td>Alaska</td>\n",
       "      <td>738432</td>\n",
       "      <td>552166</td>\n",
       "      <td>74.8</td>\n",
       "      <td>2.708442</td>\n",
       "      <td>0.738432</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>34</th>\n",
       "      <td>15</td>\n",
       "      <td>4</td>\n",
       "      <td>40</td>\n",
       "      <td>4</td>\n",
       "      <td>9</td>\n",
       "      <td>Hawaii</td>\n",
       "      <td>1431603</td>\n",
       "      <td>1120770</td>\n",
       "      <td>78.3</td>\n",
       "      <td>2.794071</td>\n",
       "      <td>1.431603</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>27</th>\n",
       "      <td>31</td>\n",
       "      <td>6</td>\n",
       "      <td>40</td>\n",
       "      <td>2</td>\n",
       "      <td>4</td>\n",
       "      <td>Nebraska</td>\n",
       "      <td>1896190</td>\n",
       "      <td>1425853</td>\n",
       "      <td>75.2</td>\n",
       "      <td>3.164240</td>\n",
       "      <td>1.896190</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>25</td>\n",
       "      <td>40</td>\n",
       "      <td>4</td>\n",
       "      <td>8</td>\n",
       "      <td>Arizona</td>\n",
       "      <td>6828065</td>\n",
       "      <td>5205215</td>\n",
       "      <td>76.2</td>\n",
       "      <td>3.661359</td>\n",
       "      <td>6.828065</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>40</td>\n",
       "      <td>22</td>\n",
       "      <td>40</td>\n",
       "      <td>3</td>\n",
       "      <td>7</td>\n",
       "      <td>Oklahoma</td>\n",
       "      <td>3911338</td>\n",
       "      <td>2950017</td>\n",
       "      <td>75.4</td>\n",
       "      <td>5.624674</td>\n",
       "      <td>3.911338</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "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; the northeast seems to have the lowest."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {
    "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": {},
   "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": {},
   "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": {},
   "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": {},
   "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 black people in the population, and a lower proportion of Hispanic people 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.8.5"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
