Plotting the hourly arrest rate
In this exercise, you'll create a line plot from the hourly_arrest_rate object. A line plot is appropriate in this case because you're showing how a quantity changes over time.
This plot should help you to spot some trends that may not have been obvious when examining the raw numbers!
แบบฝึกหัดนี้เป็นส่วนหนึ่งของหลักสูตร
Analyzing Police Activity with pandas
คำแนะนำการฝึกหัด
- Import
matplotlib.pyplotusing the aliasplt. - Create a line plot of
hourly_arrest_rateusing the.plot()method. - Label the x-axis as
'Hour', label the y-axis as'Arrest Rate', and title the plot'Arrest Rate by Time of Day'. - Display the plot using the
.show()function.
แบบฝึกหัดเชิงโต้ตอบแบบลงมือทำ
ลองทำแบบฝึกหัดนี้โดยเติมโค้ดตัวอย่างนี้ให้สมบูรณ์
# Import matplotlib.pyplot as plt
# Create a line plot of 'hourly_arrest_rate'
# Add the xlabel, ylabel, and title
plt.xlabel(____)
plt.ylabel(____)
plt.title(____)
# Display the plot