如何在 dask 数据框中删除带有 nan 单元格的行?
How to drop rows with nan cell in dask dataframe?
我有一个 dask 数据框,我想在其中删除 "selling_price" 列中具有 NAN 值的所有行
image_features_df.head(3)
feat1 feat2 feat3 ... feat25087 feat25088 fid selling_price
0 0.0 0.0 0.0 ... 0.0 0.0 2 269.00
1 0.2 0.0 0.8 ... 0.0 0.3 22 NAN
2 0.5 0.0 0.4 ... 0.0 0.1 70 NAN
以上 table 显示了我的数据框的视图。
我希望输出是一个 dask 数据帧,在我的 "selling_price" 列中没有任何 NAN 单元格。
预期输出:
image_features_df.head(3)
feat1 feat2 feat3 ... feat25087 feat25088 fid selling_price
0 0.0 0.0 0.0 ... 0.0 0.0 2 269.00
4 0.3 0.1 0.0 ... 0.0 0.3 26 1720.00
6 0.8 0.0 0.0 ... 0.0 0.1 50 18145.25
能否请您尝试以下操作,如果在 selling_price 列中找到 NaN,这将删除行。
df.dropna(subset=['selling_price'])
我有一个 dask 数据框,我想在其中删除 "selling_price" 列中具有 NAN 值的所有行
image_features_df.head(3)
feat1 feat2 feat3 ... feat25087 feat25088 fid selling_price
0 0.0 0.0 0.0 ... 0.0 0.0 2 269.00
1 0.2 0.0 0.8 ... 0.0 0.3 22 NAN
2 0.5 0.0 0.4 ... 0.0 0.1 70 NAN
以上 table 显示了我的数据框的视图。
我希望输出是一个 dask 数据帧,在我的 "selling_price" 列中没有任何 NAN 单元格。
预期输出:
image_features_df.head(3)
feat1 feat2 feat3 ... feat25087 feat25088 fid selling_price
0 0.0 0.0 0.0 ... 0.0 0.0 2 269.00
4 0.3 0.1 0.0 ... 0.0 0.3 26 1720.00
6 0.8 0.0 0.0 ... 0.0 0.1 50 18145.25
能否请您尝试以下操作,如果在 selling_price 列中找到 NaN,这将删除行。
df.dropna(subset=['selling_price'])