close

How to select rows with NaN in particular column?

Hello Guys, How are you all? Hope You all Are Fine. Today We Are Going To learn about How to select rows with NaN in particular column in Python. So Here I am Explain to you all the possible Methods here.

Without wasting your time, Let’s start This Article.

Table of Contents

How to select rows with NaN in particular column?

  1. How to select rows with NaN in particular column?

    Here are a few alternatives:
    In [28]: df.query('Col2 != Col2') # Using the fact that: np.nan != np.nan Out[28]: Col1 Col2 Col3 1 0 NaN 0.0

  2. select rows with NaN in particular column

    Here are a few alternatives:
    In [28]: df.query('Col2 != Col2') # Using the fact that: np.nan != np.nan Out[28]: Col1 Col2 Col3 1 0 NaN 0.0

Method 1

Try the following:

df[df['Col2'].isnull()]

Method 2

Here are a few alternatives:

In [28]: df.query('Col2 != Col2') # Using the fact that: np.nan != np.nan
Out[28]:
   Col1  Col2  Col3
1     0   NaN   0.0

In [29]: df[np.isnan(df.Col2)]
Out[29]:
   Col1  Col2  Col3
1     0   NaN   0.0

Summery

It’s all About this issue. Hope all Methods helped you a lot. Comment below Your thoughts and your queries. Also, Comment below which Method worked for you? Thank You.

Also, Read