get indexes where value is na pandas 1

get indexes where value is na pandas

rows_with_nan = [index for index, row in df.iterrows() if row.isnull().any()]

Here is what the above code is Doing:
1. Iterate over each row in the dataframe
2. Check if any of the values in the row are NaN
3. If any of the values are NaN, add the index of the row to the list of rows with NaN

Similar Posts