We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1.df[df['Age']==None]
df[df['Age']==None]=0 df.head(3)
以上代码无法筛选出NaN值 2.df[df['Age'].isnull()]
df[df['Age'].isnull()] = 0 # 还好 df.head(3)
以上代码可以筛选出NaN值,但是df[df['Age'].isnull()] = 0会将NaN值所在行全部置0,使得结果有误,且后面的重复值相关代码使用的也是这一行代码生成的数据 3.df[df['Age'] == np.nan]
df[df['Age'].isnull()] = 0
df[df['Age'] == np.nan] = 0 df.head()
以上代码中,np.nan不可以与任何数进行比较。使用np.isnan()进行修复
np.nan
np.isnan()
The text was updated successfully, but these errors were encountered:
No branches or pull requests
1.df[df['Age']==None]
以上代码无法筛选出NaN值
2.df[df['Age'].isnull()]
以上代码可以筛选出NaN值,但是
df[df['Age'].isnull()] = 0
会将NaN值所在行全部置0,使得结果有误,且后面的重复值相关代码使用的也是这一行代码生成的数据3.df[df['Age'] == np.nan]
以上代码中,
np.nan
不可以与任何数进行比较。使用np.isnan()
进行修复The text was updated successfully, but these errors were encountered: