-
Emergency Response Planning ⛑️🚨: Enables emergency services such as ambulances, fire departments, and police to strategically plan their response based on accident severity and frequency, ensuring timely assistance where it's needed the most.
-
Resource Allocation 🤕⚖️: Helps in the efficient allocation of resources, both human and material, to regions with higher accident severity, ensuring that hospitals, emergency rooms, and law enforcement agencies are adequately equipped and staffed.
-
Policy Formulation 🚓👮: Provides valuable insights for policymakers and governmental agencies to formulate effective traffic safety policies and regulations. By understanding accident patterns, authorities can design targeted interventions to enhance road safety.
Link for the dashboard is here
- below explanation is a part of EDA_on_Vehicle_Accidents.ipynb
In this project, we analyze road accident data using Python and various data visualization libraries like Pandas, NumPy, Matplotlib, and Seaborn. The dataset contains information about different aspects of road accidents, such as accident severity, vehicle types, road conditions, and weather conditions.
First, we loaded the dataset and performed initial data exploration:
import pandas as pd
import numpy as np
# Load data
data = pd.read_csv("accident_data.csv")
# Check data info
data.info()
# Convert "Accident Date" to datetime
data["Accident Date"] = pd.to_datetime(data["Accident Date"], format="%d-%m-%Y")
We explored various columns to understand the unique values and their counts:
# Explore unique values in non-integer columns
for column in data.columns:
if type(data[column][1]) == str:
print(data[column].value_counts())
print("No of Unique values: ", len(data[column].value_counts()))
print("*" * 30)
We created visualizations to understand accident trends over the years and the impact of different factors on accidents.
-
Accidents Over Years:
- Created a bar chart showing the total number of accidents each year.
-
Year-over-Year (YoY) Accident Growth:
- Calculated YoY growth percentage for accidents and created a bar chart.
-
Casualties Over Years:
- Plotted the total number of casualties each year.
-
Fatal Accidents Over Years:
- Analyzed the number of fatal accidents and their YoY growth.
print("total fatal Accidents :",len(df2[df2["Accident_Severity"] == "Fatal"])) year_wise_fatal_accidents = df2[df2["Accident_Severity"] == "Fatal"].groupby("years")["Index"].count().reset_index() year_wise_fatal_accidents["Yoy Growth"] = year_wise_fatal_accidents["Index"].pct_change()*100 year_wise_fatal_accidents.round(2) year_wise_fatal_accidents_plot = GenericBarPlot(year_wise_fatal_accidents,x= "years",y = "Index",title= "Fatal Accidents over Years") # year_wise_fatal_accidents_plot.plot() year_wise_fatal_accidents
-
Serious Accidents Over Years:
-
Slight Accidents Over Years:
- Investigated slight accidents and their YoY growth.
numberOfSlightaccidents = df2[df2["Accident_Severity"] == "Slight"].groupby("years")["Index"].count().reset_index() numberOfSlightaccidents["Yoy change %"] = numberOfSlightaccidents["Index"].pct_change().round(4)*100 numberOfSlightaccidents_plot = GenericBarPlot(numberOfSlightaccidents,y = "Index",x= "years",title="Number of Slight Accidents over Years") numberOfSlightaccidents_plot.plot() numberOfSlightaccidents
-
Vehicle Group Analysis:
- Grouped vehicles into categories and analyzed casualties for each group.
casualities_vehicle_group_2 = df2.groupby('Vehicle_group')["Index"].count().reset_index().sort_values(by = 'Index',ascending = False) casualities_vehicle_group_2
This analysis provides valuable insights into road accidents, including trends over the years and the impact of various factors. Understanding these patterns can aid in policymaking and implementing safety measures to reduce accidents and casualties on the roads. Further analyses and machine learning models can be explored to predict accidents and prioritize preventive actions.
- Note: we can use this data to crosscheck if our dashboard is providing the correct information or not