# Titanic (2012)

> 891 Titanic passengers with class, sex, age and fare. Predict who survived.

Page: https://mralbu.github.io/ai-datasets/d/titanic

## Key facts

- Category: Tabular
- Task: Binary classification (did the passenger survive?)
- Creators: Kaggle (passenger records from Encyclopedia Titanica)
- Size: 1,309 passengers (891 labeled)
- Splits: train 891, test 418
- Input: 11 columns, numeric and categorical, with missing values
- Labels: Survived (1) or not (0)
- License: Kaggle competition data
- Homepage: https://www.kaggle.com/competitions/titanic
- Hugging Face: [phihung/titanic](https://huggingface.co/datasets/phihung/titanic)
- Sampled at Hub revision 9753139e0b9d454ab4fd22e884290260db5fc7b6 (2026-11-07)

## Why it matters

Kaggle's "getting started" competition and, for many people, their first end-to-end ML project. It has everything a real tabular problem has in miniature: missing values, categorical features, feature engineering (titles hidden in names, family size) and a strong signal you can explain.

## Worth knowing

- "Women and children first" is plainly visible: about 74% of women survived, against about 19% of men.
- Class mattered too. About 63% of first-class passengers survived, against 24% in third class.
- Cabin is missing for about 77% of passengers and Age for about 20%, so imputation is part of the exercise.
- The ship carried about 2,224 people; the dataset covers the 1,309 passengers, not the crew.

## Get the data

```bash
# pip install -U huggingface_hub
hf download phihung/titanic --repo-type dataset \
  --local-dir titanic
```

```python
from datasets import load_dataset   # pip install datasets

ds = load_dataset("phihung/titanic")
print(ds)
```

```python
import polars as pl

df = pl.read_parquet("hf://datasets/phihung/titanic@~parquet/default/train/*.parquet")
print(df.shape)
```

## Related datasets

- [Spaceship Titanic](https://www.kaggle.com/competitions/spaceship-titanic): 2022, Kaggle's sci-fi remake
