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

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 *