ComenzarEmpieza gratis

Comparing speeding outcomes by gender

When a driver is pulled over for speeding, many people believe that gender has an impact on whether the driver will receive a ticket or a warning. Can you find evidence of this in the dataset?

First, you'll create two DataFrames of drivers who were stopped for speeding: one containing females and the other containing males.

Then, for each gender, you'll use the stop_outcome column to calculate what percentage of stops resulted in a "Citation" (meaning a ticket) versus a "Warning".

Este ejercicio forma parte del curso

Analyzing Police Activity with pandas

Ver curso

Instrucciones del ejercicio

  • Create a DataFrame, female_and_speeding, that only includes female drivers who were stopped for speeding.
  • Create a DataFrame, male_and_speeding, that only includes male drivers who were stopped for speeding.
  • Count the stop outcomes for the female drivers and express them as proportions.
  • Count the stop outcomes for the male drivers and express them as proportions.

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

# Create a DataFrame of female drivers stopped for speeding
female_and_speeding = ri[____]

# Create a DataFrame of male drivers stopped for speeding
male_and_speeding = ri[____]

# Compute the stop outcomes for female drivers (as proportions)
print(female_and_speeding.____)

# Compute the stop outcomes for male drivers (as proportions)
print(male_and_speeding.____)
Editar y ejecutar código