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 drop the rows where the 'EPS' column isn’t NaN by calling notna on the column.

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 *