根据索引填写缺失值
我尝试以这样的方式将缺少值估计为缺失值
null = data.isnull().sum()*100/len(data)
,并且这样的
null_column = null[(null>= 10.0) & (null <= 40.0)].index
过滤器输出类型是索引,
我如何使用 fillna
在这样的
null_column = null[(null>= 10.0) & (null <= 40.0)].index
data.fillna(percent_column2.median(), inplace=True)
结果之前,
基于索引我的代码替换每个列中的中位数索引没有中位数
,但是当我删除 index 时,它起作用了,但是替换的中位数并不是每个列中的中位数。但是,在原始数据框架中不在原始数据框架中的两个百分比缺失值的值中位数。如何根据索引填充NAN值以替换原始数据框架?
i try to percentace missing value like this
null = data.isnull().sum()*100/len(data)
and filter like this
null_column = null[(null>= 10.0) & (null <= 40.0)].index
the output type is index
how can i using fillna to replace median in every column based on index
my code before like this
null_column = null[(null>= 10.0) & (null <= 40.0)].index
data.fillna(percent_column2.median(), inplace=True)
the result always
index doesnt have median
but when i deleted index it works but the median that replaced is not median in every column. But, median that 2 values of percentage missing value not in original dataframe. How can i fill nan value based on index to replace in original data frame?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我想这样的事情:
I guess something like this: