MulaiMulai sekarang secara gratis

Replacing missing values with constants

While removing missing data entirely maybe a correct approach in many situations, this may result in a lot of information being omitted from your models.

You may find categorical columns where the missing value is a valid piece of information in itself, such as someone refusing to answer a question in a survey. In these cases, you can fill all missing values with a new category entirely, for example 'No response given'.

Latihan ini adalah bagian dari kursus

Feature Engineering for Machine Learning in Python

Lihat Kursus

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Print the count of occurrences
print(so_survey_df['Gender']____)
Edit dan Jalankan Kode