What should happen when a dataset has no cabin number, age, or port for a passenger? A missing value is an absent, unreadable, or unavailable entry, often represented as NaN. Leaving these entries untreated can cause model-fitting errors. section 13.2
Clean missing values by making a column-by-column decision:
- Count missing entries with is_na (or is_null), which returns 1 for NaN and 0 otherwise. section 13.2
- Drop a column when too many values are missing; the Titanic Cabin column is removed. section 13.2
- Fill numerical gaps such as Age with the column median, and fill categorical gaps such as Embarked with U. section 13.2
- Save the cleaned dataset before using it for modeling. section 13.2
raw_data.isna().sum() Output: PassengerId 0 Survived 0 Pclass 0 Name 0 Sex 0 Age 177 SibSp 0 Parch 0 Ticket 0 Fare 0 Cabin 687 Embarked 2
Inspect missing-value counts across every Titanic dataset column before choosing whether to remove or fill entries. section 13.2


































