Search is not available for this dataset
Year
int64 2.02k
2.02k
| Homicides
int64 174
276
| Wounded
int64 746
1.3k
|
|---|---|---|
2,024
| 219
| 866
|
2,023
| 257
| 892
|
2,022
| 261
| 996
|
2,021
| 276
| 1,191
|
2,020
| 254
| 942
|
2,019
| 211
| 746
|
2,018
| 211
| 879
|
2,017
| 257
| 1,137
|
2,016
| 262
| 1,296
|
2,015
| 174
| 843
|
2025 Homicide Trend Analysis
π This project provides Python-based data visualization examples for analyzing homicide trends over time.
Source: HeyJackass.com
π Overview
This repository includes Python scripts to visualize homicide data using:
- Bar graphs
- Pie charts
- DataFrames from
pandas
All visualizations are based on real-world data spanning from 2015 to 2024.
π Sample Data
| Year | Homicides |
|---|---|
| 2024 | 219 |
| 2023 | 257 |
| 2022 | 261 |
| 2021 | 276 |
| 2020 | 254 |
| 2019 | 211 |
| 2018 | 211 |
| 2017 | 257 |
| 2016 | 262 |
| 2015 | 174 |
π Visualization Examples
1. Bar Graph: Homicides Per Year
import matplotlib.pyplot as plt
import pandas as pd
# Data from your CSV
data = {
'Year': [2024, 2023, 2022, 2021, 2020, 2019, 2018, 2017, 2016, 2015],
'Homicides': [219, 257, 261, 276, 254, 211, 211, 257, 262, 174]
}
# Convert to DataFrame
df = pd.DataFrame(data)
# Plot bar graph
plt.figure(figsize=(10, 6))
plt.bar(df['Year'].astype(str), df['Homicides'], color='skyblue')
plt.title('Homicides Per Year')
plt.xlabel('Year')
plt.ylabel('Number of Homicides')
plt.xticks(rotation=45)
plt.tight_layout()
# Show the plot
plt.show()
2. Pie Chart: Distribution of Incidents by Year
from datasets import load_dataset
import matplotlib.pyplot as plt
# Load the dataset
ds = load_dataset("ajsbsd/hj")
# Count year occurrences
year_counts = {}
for entry in ds['train']:
year = entry.get('Year', None)
if year is not None:
year_counts[year] = year_counts.get(year, 0) + 1
# Sort years
sorted_years = sorted(year_counts.items())
years, counts = zip(*sorted_years)
# Plot pie chart
plt.figure(figsize=(8, 8))
plt.pie(counts, labels=years, autopct='%1.1f%%', startangle=140)
plt.title('Distribution of Incidents by Year')
plt.axis('equal')
plt.show()
BSD-3-Clause-Clear License
See LICENSE file for full text.
- Downloads last month
- 11