Categories
Python Answers

How to delete a DataFrame row in Python Pandas based on column value?

Spread the love

To delete a DataFrame row in Python Pandas based on column value, we can set get the rows we want with a condition.

For instance, we write

df = df[df.line_race != 0]

to get the rows where the line_race column isn’t 0

Leave a Reply

Your email address will not be published.

If you like the content of this blog, subscribe to my email list to get exclusive articles not available to anyone else.