Catalog / Tabular
Titanic (2012)
891 Titanic passengers with class, sex, age and fare. Predict who survived.
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.
Get the data
# pip install -U huggingface_hub
hf download phihung/titanic --repo-type dataset \
--local-dir titanicfrom datasets import load_dataset # pip install datasets
ds = load_dataset("phihung/titanic")
print(ds)import polars as pl
df = pl.read_parquet("hf://datasets/phihung/titanic@~parquet/default/train/*.parquet")
print(df.shape)- Year
- 2012
- Creators
- Kaggle (passenger records from Encyclopedia Titanica)
- Task
- Binary classification (did the passenger survive?)
- 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
Samples
| PassengerId | Survived | Pclass | Name | Sex | Age | SibSp | Parch | Ticket | Fare | Cabin | Embarked |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 274 | 0 | 1 | Natsch, Mr. Charles H | male | 37 | 0 | 1 | PC 17596 | 29.7 | C118 | C |
| 142 | 1 | 3 | Nysten, Miss. Anna Sofia | female | 22 | 0 | 0 | 347081 | 7.75 | ∅ | S |
| 515 | 0 | 3 | Coleff, Mr. Satio | male | 24 | 0 | 0 | 349209 | 7.4958 | ∅ | S |
| 347 | 1 | 2 | Smith, Miss. Marion Elsie | female | 40 | 0 | 0 | 31418 | 13 | ∅ | S |
| 191 | 1 | 2 | Pinsky, Mrs. (Rosa) | female | 32 | 0 | 0 | 234604 | 13 | ∅ | S |
| 475 | 0 | 3 | Strandberg, Miss. Ida Sofia | female | 22 | 0 | 0 | 7553 | 9.8375 | ∅ | S |
| 632 | 0 | 3 | Lundahl, Mr. Johan Svensson | male | 51 | 0 | 0 | 347743 | 7.0542 | ∅ | S |
| 7 | 0 | 1 | McCarthy, Mr. Timothy J | male | 54 | 0 | 0 | 17463 | 51.8625 | E46 | S |
| 83 | 1 | 3 | McDermott, Miss. Brigdet Delia | female | ∅ | 0 | 0 | 330932 | 7.7875 | ∅ | Q |
| 343 | 0 | 2 | Collander, Mr. Erik Gustaf | male | 28 | 0 | 0 | 248740 | 13 | ∅ | S |
| 693 | 1 | 3 | Lam, Mr. Ali | male | ∅ | 0 | 0 | 1601 | 56.4958 | ∅ | S |
| 568 | 0 | 3 | Palsson, Mrs. Nils (Alma Cornelia Berglund) | female | 29 | 0 | 4 | 349909 | 21.075 | ∅ | S |
| 383 | 0 | 3 | Tikkanen, Mr. Juho | male | 32 | 0 | 0 | STON/O 2. 3101293 | 7.925 | ∅ | S |
| 888 | 1 | 1 | Graham, Miss. Margaret Edith | female | 19 | 0 | 0 | 112053 | 30 | B42 | S |
| 620 | 0 | 2 | Gavey, Mr. Lawrence | male | 26 | 0 | 0 | 31028 | 10.5 | ∅ | S |
| 628 | 1 | 1 | Longley, Miss. Gretchen Fiske | female | 21 | 0 | 0 | 13502 | 77.9583 | D9 | S |
∅ = missing value
What one record actually looks like (raw JSON, row 273)
{
"Age": 37,
"Cabin": "C118",
"Embarked": "C",
"Fare": 29.7,
"Name": "Natsch, Mr. Charles H",
"Parch": 1,
"PassengerId": 274,
"Pclass": 1,
"Sex": "male",
"SibSp": 0,
"Survived": 0,
"Ticket": "PC 17596"
}Media fields point at a local copy; on Hugging Face they are bytes in a Parquet file.
Sampled 2026-11-07 from phihung/titanic at revision 9753139
The whole dataset at once
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.
Related datasets
- Spaceship Titanic: 2022, Kaggle's sci-fi remakekaggle.com ↗