Statistical analysis of aircraft accidents from 1919 to 2023

Statistical analysis of aircraft accidents from 1919 to 2023

In-depth analysis of aircraft accidents over the last century using Python and data analysis libraries. Exploring causes, trends, and risk factors to enhance aviation safety.

Context and objective

Have you ever wondered how air travel has become so safe over the years? I dove into this fascinating question by analyzing aviation accidents from 1919 to 2023. Working with a massive dataset of about 25,000 records, I explored key details like:

  • When and where each accident happened
  • What type of aircraft was involved
  • Which airline was operating the flight
  • How many people were affected
  • What caused the accident

My goal? To uncover patterns and trends that could help make flying even safer. I wanted to provide valuable insights that airlines and safety regulators could actually use to prevent future accidents.


How I tackled the challenge

I built my analysis around a Jupyter Notebook - think of it as my digital workbench where I could experiment with the data and see results instantly.

1. Getting the data ready

First things first, I needed to get all that historical data into a format I could work with. Here’s how I started with pandas, my go-to tool for data wrangling:

import pandas as pd
df = pd.read_csv('data/aviation_disasters.csv')

Then, I needed to make sure all those dates were in a format that Python could understand and analyze:

df['date'] = pd.to_datetime(df['date'], errors='coerce')

2. Cleaning up the mess

Like any historical dataset, this one needed some TLC. I had to deal with missing information and make sure what I had was reliable:

df.dropna(subset=['date', 'aircraft_type', 'country'], inplace=True)

3. Digging into the numbers

I wanted to see how aviation safety has evolved over the decades, so I counted accidents by year:

df['year'] = df['date'].dt.year
annual_accidents = df.groupby('year').size()

Understanding airline patterns

I also looked at which airlines had experienced more incidents, to spot any patterns:

accidents_by_operator = df['operator'].value_counts()

4. Making the data tell its story

Numbers are great, but pictures tell better stories. I created interactive visualizations to bring the data to life.

Here’s how I created a chart showing how aviation safety has improved over time:

import matplotlib.pyplot as plt
import seaborn as sns
plt.figure(figsize=(12,6))
sns.barplot(x=annual_accidents.index, y=annual_accidents.values)
plt.xlabel('Year')
plt.ylabel('Number of Accidents')
plt.title('How aviation safety has evolved (1919-2023)')
plt.show()

What I discovered

After diving deep into the data, here’s what I found:

  • Flying gets safer every year: Thanks to better technology and stricter rules, accidents have become increasingly rare
  • Not all planes are created equal: Some aircraft types and airlines showed higher accident rates than others
  • Location matters: Certain parts of the world had more incidents than others

Bumps along the way

1. Dealing with incomplete records

Like any historical dataset, this one had its gaps. Some accidents didn’t have all the details we’d like (imagine trying to document something from 1919!). I had to carefully clean the data while preserving as much valuable information as possible.

2. Making sense of different formats

Every country and airline seemed to have its own way of recording information. Here’s how I standardized everything:

df['operator'] = df['operator'].str.upper().str.strip()
df['country'] = df['country'].str.upper().str.strip()

Looking ahead

This journey through aviation history has taught us a lot about how far we’ve come in making air travel safer. While we can’t predict every accident, we can learn from the past to prevent future incidents. I’m already thinking about how machine learning could help spot potential risks before they become problems. The sky’s the limit when it comes to making flying even safer!

ALL PROJECTS →

Let's face the challenges together

From process optimization to complex problem-solving, I can help you with a practical and measurable approach.

Recommended resources

Netsons - Hosting SSD 10

Your first website deserves SSD speed! Affordable yet powerful hosting with included domain, 10 GB space and free SSL certificate.

DigitalOcean - The cloud that speaks your language

Simple, powerful cloud infrastructure with predictable pricing. Droplets, Kubernetes, managed databases and app platform for developers who want to focus on code.

Google Workspace - Your business in one click

Transform the way you work with professional email, collaborative documents, video conferencing and cloud storage in one integrated solution.