Categories
Python Answers

How to drop rows of a Python Pandas DataFrame whose value in a certain column is NaN?

Spread the love

To drop rows of a Python Pandas DataFrame whose value in a certain column is NaN, we call the notna method.

For instance, we write

df = df[df['EPS'].notna()]

to filter out the rows with 'EPS' column value that’s NaN by calling thw notna method on the column.

Then we get the filtered rows with df[df['EPS'].notna()]

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *