dropna()在给定阈值的情况下,对axis = 1不起作用[重复] 。

问题描述 投票:0回答:1

对于给定的数据集

enter image description here

我在轴线=1和阈值=2的地方进行了降噪。

df.dropna(thresh=2,axis=1)

产出是

enter image description here

这似乎并不正确,我期望的是删除索引=1和2的列,因为这两个列都有NaN的出现>=2。

代码在axis=0的情况下工作得很好

python-3.x pandas missing-data
1个回答
0
投票

尝试使用 df.dropna(thresh=6,axis=1) 对于同一数据帧。

© www.soinside.com 2019 - 2024. All rights reserved.