Menu

Cleaning the Dataset

Cleaning the Dataset

After identifying missing values and duplicate records, the next step is to clean the dataset. Removing incomplete or repeated records improves the quality of the recommendation system.

Code

news = news.dropna()
news = news.drop_duplicates()

Explanation

  • dropna() removes rows containing missing values.
  • drop_duplicates() removes duplicate news articles.

Output

A cleaned dataset is generated and is ready for feature selection.