select rows with nan pandas

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

Here is what the above code is Doing:
1. We’re creating a new dataframe called df_no_missing.
2. We’re using the .dropna() method to drop all rows that have missing values.
3. We’re using the .reset_index() method to reset the index of the dataframe.
4. We’re using the .isnull() method to check if there are any missing values in the dataframe.
5. We’re using the .any() method to check if any of the columns in the dataframe have missing values.
6. We’re using the .sum() method to sum up the number of missing values in each column.
7. We’re using the .sort_values() method to sort the columns by the number of missing values.
8. We’re using the .head() method to display the first 5 rows of the dataframe.