In [1]:
%matplotlib inline
import matplotlib.pyplot as plt
import numpy as np
import pandas as pd
import seaborn as sns
In [2]:
df = pd.read_csv('data/police_locals.csv')
df = df.replace('**',np.nan)
df['all'] = df['all'].astype('float')
df['white'] = df['white'].astype('float')
df['non-white'] = df['non-white'].astype('float')
df['black'] = df['black'].astype('float')
df['hispanic'] = df['hispanic'].astype('float')
In [3]:
df.head()
Out[3]:
In [4]:
len(df)
Out[4]:
In [5]:
df[['white','non-white']].describe()
Out[5]:
In [6]:
sns.set_context("talk")
sns.set_style("whitegrid")
sns.boxplot(df[['white','non-white']]);
This data comes from an article published on 538 on August 20 entitled, Most Police Don’t Live In The Cities They Serve. From the article:
In Ferguson, Missouri, where protests continue following the shooting of a teenager by a police officer this month, more than two-thirds of the civilian population is black. Only 11 percent of the police force is. The racial disparity is troubling enough on its own, but it’s also suggestive of another type of misrepresentation. Given Ferguson’s racial gap, it’s likely that many of its police officers live outside city limits.
The above dataset, published by 538 on this GitHub repository contains the fractions of police officers who live within the city they serve, for different races of police officers for 75 cities across the U.S. Now we can develop a story around that data: