Python, Pandas : Return only those rows which have missing values

后端 未结 6 944
臣服心动
臣服心动 2021-01-30 06:58

While working in Pandas in Python...

I\'m working with a dataset that contains some missing values, and I\'d like to return a dataframe which contains only those rows wh

6条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-30 07:14

    You can use any axis=1 to check for least one True per row, then filter with boolean indexing:

    null_data = df[df.isnull().any(axis=1)]
    

提交回复
热议问题