尝试用 pandas 替换 nan 值,但错误:列必须与键长度相同
这是Kaggle中的一个简单项目,只是模仿一个博客,但是失败了。 在此处输入图像描述
train_inf['Age']=train_inf.fillna(train_inf[ '年龄'].中位数()) ValueError: 列必须与键长度相同
只是这个代码
我在网上搜索了很长时间。但没有用。请帮助或尝试给出一些如何实现这一目标的想法。 提前致谢。
It is a simple project in Kaggle, just imitating one blog, but failed.
enter image description here
train_inf['Age']=train_inf.fillna(train_inf['Age'].median())
ValueError: Columns must be same length as key
just this code
I am searching for a long time on net. But no use. Please help or try to give some ideas how achieve this.
Thanks in advance.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您已经很接近了,需要指定列
Age
来替换缺失值:You are close, need specify column
Age
for replace missing values: