project analysis

# Extract year and month from the ‘date’ column for further analysis
data[‘date’] = pd.to_datetime(data[‘date’])
data[‘year’] = data[‘date’].dt.year
data[‘month’] = data[‘date’].dt.month

# Plotting the temporal trends
plt.figure(figsize=(20, 7))

# Plotting yearly trends
plt.subplot(1, 2, 1)
sns.countplot(data=data, x=’year’, palette=”viridis”)
plt.title(“Yearly Trend of Police Shootings”)

# Plotting monthly trends (averaged over years)
plt.subplot(1, 2, 2)
sns.countplot(data=data, x=’month’, palette=”viridis”)
plt.title(“Average Monthly Distribution of Police Shootings”)

# Display the plots
plt.tight_layout()
plt.show()

Here’s the analysis of police shootings based on the days of the week:

Incidents are fairly evenly distributed across the days of the week. A slight increase is observed on Wednesdays and Fridays, while Sundays tend to have slightly fewer incidents compared to other days.

Here’s the analysis of police shootings based on the days of the week:

Incidents are fairly evenly distributed across the days of the week. A slight increase is observed on Wednesdays and Fridays, while Sundays tend to have slightly fewer incidents compared to other days.

Leave a Reply

Your email address will not be published. Required fields are marked *