Skip to content

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Data Science Internship — Task 2

Task

Perform data cleaning and exploratory data analysis (EDA) on a dataset of your choice, such as the Titanic dataset from Kaggle. Explore the relationships between variables and identify patterns and trends in the data.

Dataset

Titanic dataset — Task 2 dataset from Prodigy-InfoTech/data-science-datasets, originally sourced from Kaggle's Titanic competition.

Column Description
PassengerId Unique identifier
Survived 0 = Did not survive, 1 = Survived
Pclass Ticket class (1st, 2nd, 3rd)
Name Passenger name
Sex Gender
Age Age in years
SibSp Number of siblings/spouses aboard
Parch Number of parents/children aboard
Ticket Ticket number
Fare Passenger fare
Cabin Cabin number
Embarked Port of embarkation (C/Q/S)

Note: train.csv in this repo is a synthetic dataset built to match the real Titanic dataset's structure and statistical patterns (survival rates by class/gender, missing-value proportions in Age/Cabin/Embarked). Swap in the real file from the link above before final submission — no code changes needed, since column names match exactly.

Tech Stack

  • Python 3
  • pandas, numpy — data loading and cleaning
  • matplotlib, seaborn — visualization

Repository Structure

.
├── generate_sample_data.py     # creates the sample train.csv
├── train.csv                   # dataset (swap with the real file)
├── titanic_eda.py              # full cleaning + EDA script
├── 01_age_distribution.png … 13_age_by_class_and_survival.png   # generated charts
└── README.md

How to Run

pip install pandas numpy matplotlib seaborn

# (optional) regenerate the sample dataset
python generate_sample_data.py

# run the full cleaning + EDA
python titanic_eda.py

titanic_eda.py uses # %% cell markers, so it can also be run cell-by-cell in VS Code (with the Jupyter extension) or in a Jupyter notebook.

Data Cleaning Steps

  • Age (~20% missing): filled with median (robust to outliers)
  • Embarked (a couple missing): filled with mode (most common port)
  • Cabin (~77% missing): converted to a binary HasCabin flag instead of dropping the column outright
  • Duplicates: checked and removed if present
  • Feature engineering: FamilySize (SibSp + Parch + 1) and IsAlone derived for deeper analysis

Analysis Performed

Univariate: age distribution, survival count, passenger class distribution, fare distribution

Bivariate: survival by class, survival by gender, Age vs Fare scatter (colored by survival), fare by class boxplot, survival by embarkation port, survival by family size

Multivariate: survival by class + gender combined, correlation heatmap across numeric features, age distribution faceted by class and survival outcome

Key Insights

  • Overall survival rate is roughly 35%, consistent with the historical Titanic outcome.
  • Class matters: 1st class passengers survived at a much higher rate than 3rd class (59.4% vs 23.9% in this run).
  • Gender matters most: women survived at a dramatically higher rate than men across every class (66.6% vs 16.1% overall) — consistent with the "women and children first" evacuation protocol.
  • Class and gender compound: 1st class women had the highest survival rate of any group (94.0%); 3rd class men had the lowest (6.1%).
  • Family size: passengers traveling completely alone had slightly lower survival odds than those in small families; the pattern for very large families is noisier due to smaller sample size.
  • Fare and class are strongly correlated, and both correlate with survival — higher fare (tied to higher class) meant better survival odds.

About

This repository documents Task 2 of a Data Science Internship, recreating a Titanic EDA workflow: loading and inspecting the data, cleaning it, engineering a couple of extra features, and building a set of univariate, bivariate, and multivariate visualizations to surface patterns in who survived.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages