如何在dask数据框中删除含有nan单元格的行,有更长的操作方法吗?
- 内容介绍
- 文章标签
- 相关推荐
本文共计299个文字,预计阅读时间需要2分钟。
我有模糊的数据框架,想在其中删除selling_price列中包含NAN值的所有行。pythonimport pandas as pdimport numpy as np
示例数据data={ 'selling_price': [100, np.nan, 200, np.nan, 300], 'product_id': [1, 2, 3, 4, 5]}df=pd.DataFrame(data)
删除包含NAN值的行df=df.dropna(subset=['selling_price'])
输出结果print(df.head(3))
我有一个模糊的数据框,我想在其中删除“selling_price”列中具有NAN值的所有行image_我有一个模糊的数据框,我想在其中删除“ selling_price”列中具有NAN值的所有行
image_features_df.head(3) feat1 feat2 feat3 ... feat25087 feat25088 fid selling_price0 0.0 0.0 0.0 ... 0.0 0.0 2 269.001 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
上表显示了我的数据框的视图。
我希望输出为dask数据框,而我的“ selling_price”列中没有任何NAN单元。
预期输出:
image_features_df.head(3) feat1 feat2 feat3 ... feat25087 feat25088 fid selling_price0 0.0 0.0 0.0 ... 0.0 0.0 2 269.004 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,则会删除行。
# Im just guessing the name of the helper
本文共计299个文字,预计阅读时间需要2分钟。
我有模糊的数据框架,想在其中删除selling_price列中包含NAN值的所有行。pythonimport pandas as pdimport numpy as np
示例数据data={ 'selling_price': [100, np.nan, 200, np.nan, 300], 'product_id': [1, 2, 3, 4, 5]}df=pd.DataFrame(data)
删除包含NAN值的行df=df.dropna(subset=['selling_price'])
输出结果print(df.head(3))
我有一个模糊的数据框,我想在其中删除“selling_price”列中具有NAN值的所有行image_我有一个模糊的数据框,我想在其中删除“ selling_price”列中具有NAN值的所有行
image_features_df.head(3) feat1 feat2 feat3 ... feat25087 feat25088 fid selling_price0 0.0 0.0 0.0 ... 0.0 0.0 2 269.001 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
上表显示了我的数据框的视图。
我希望输出为dask数据框,而我的“ selling_price”列中没有任何NAN单元。
预期输出:
image_features_df.head(3) feat1 feat2 feat3 ... feat25087 feat25088 fid selling_price0 0.0 0.0 0.0 ... 0.0 0.0 2 269.004 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,则会删除行。
# Im just guessing the name of the helper

