📓 Jupyter Notebook 📊 View Project Slides 🦈 Original Dataset
This project explores a global shark attack dataset using Python for data cleaning, transformation, and exploratory data analysis (EDA).
The goal of the project was to identify demographic, geographic, behavioral, and seasonal patterns associated with shark attack incidents.
Several cleaning steps were performed to improve data consistency and prepare the dataset for analysis.
- Removed unnecessary columns and duplicate information
- Standardized column names
- Cleaned text formatting and whitespace
- Standardized country names and grouped invalid values into
"other" - Categorized activities using regex pattern matching:
- swimming
- boarding / surfing
- fishing
- diving
- Standardized sex values into:
MFunknown
- Cleaned age values by extracting numeric ages and handling invalid entries
- Cleaned and standardized date values using regex and datetime parsing
- Converted valid dates into datetime format while handling invalid dates as
NaT
The analysis focused on identifying patterns across:
- activity
- country
- sex
- age
- seasonality
- time trends
- bar charts
- stacked bar charts
- histograms
- stacked histograms
- seasonal trend plots
- country comparison plots
- heatmaps
- The United States, Australia, and South Africa reported the highest number of shark attacks.
- English-speaking countries dominated the dataset, suggesting possible reporting or collection bias.
- Focusing on the top 3–4 countries would likely provide the highest business or marketing impact.
- Surfing, paddleboarding, boogie boarding, swimming, snorkeling, and bathing were among the highest-risk activities.
- Results suggest potential demand for shark-deterrent products targeting both board sports and swimwear users.
- Shark attacks were heavily skewed toward male victims.
- Males experienced more surfing- and fishing-related attacks.
- Swimming-related attacks were proportionally more common among women.
- Younger individuals appeared to face higher shark attack risk across both sexes.
- Shark attacks peaked during local summer seasons.
- Southern Hemisphere countries peaked during:
- December–February
- Northern Hemisphere countries peaked during:
- June–September
- Seasonal trends suggest that attack frequency may be strongly associated with increased human ocean activity during warmer months.
- Python
- pandas
- numpy
- seaborn
- matplotlib
- regex
The analysis revealed strong relationships between shark attacks and:
- recreational ocean activities
- demographic factors
- geographic location
- seasonal human behavior
Overall, the project demonstrates how data cleaning and exploratory analysis can uncover meaningful patterns in real-world datasets.