How to select rows with NaN in particular column?

dataframe, pandas, python

Solution

Try the following:

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

Problem

Given this dataframe, how to select only those rows that have "Col2" equal to `NaN`? ``` df = pd.DataFrame([range(3), [0, np.NaN, 0], [0, 0, np.NaN], range(3), range(3)], columns=["Col1", "Col2", "Col3"]) ``` which looks like: ``` 0 1 2 0 0 1 2 1 0 NaN 0 2 0 0 NaN 3 0 1 2 4 0 1 2 ``` The result should be this one: ``` 0 1 2 1 0 NaN 0 ```

Original source