我的数据有多稀疏?
大多数数据集都包含缺失值,通常用 NaN(Not a Number)表示。使用 Pandas 时,您可以轻松检查每一列中有多少缺失值。
让我们来看看参加问卷的开发者中,有多少人填写了年龄(在 so_survey_df 的 Age 列)以及性别(在 so_survey_df 的 Gender 列)。
本练习是课程的一部分
Python 中的机器学习特征工程
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Subset the DataFrame
sub_df = ____
# Print the number of non-missing values
print(sub_df.____)