4.1 Manually downgrading Part I offenses
The investigation by The Los Angeles Times uncovered Part I crimes that were being downgraded, and misclassified as Part II crimes.
Since we don’t have the original, incorrect classifications to work off of, we’re going to have to cheat a little! To reproduce a situation similar to the LA Times, let’s take about 20% of our aggravated assault Sandra classify them as simple assaults.
# Copy the official classification into a new column
# We'll pretend this is what was reported by the police
df['reported'] = df['is_part_i']
# Now we'll downgrade a random 15% of the Part I crimes,
# changing their reported "1" (YES a Part I crime) status
# to a 0 (NOPE not a Part I crime)
downgraded_indices = df[df.is_part_i == 1].sample(frac=0.25).index
df.loc[downgraded_indices, 'reported'] = 0
Let’s check what our original Part I vs Part II counts were
## 0 23675
## 1 7777
## Name: is_part_i, dtype: int64
How does it look now that we downgraded them?
## 0 25619
## 1 5833
## Name: reported, dtype: int64
What a decrease, we must be the best cops! …and we didn’t even have to do any police work at all.
Now it’s time for the fun part.