เริ่มต้นใช้งานเริ่มต้นใช้งานได้ฟรี

Comparing arrest rates by weather rating

Do police officers arrest drivers more often when the weather is bad? Let's find out!

  • First, you'll calculate the overall arrest rate.
  • Then, you'll calculate the arrest rate for each of the weather ratings you previously assigned.
  • Finally, you'll add violation type as a second factor in the analysis, to see if that accounts for any differences in the arrest rate.

Since you previously defined a logical order for the weather categories, good < bad < worse, they will be sorted that way in the results.

แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร

Analyzing Police Activity with pandas

ดูคอร์ส

แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ

ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์

# Calculate the overall arrest rate
print(ri_weather.____)
แก้ไขและรันโค้ด