Categories
Python Answers

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

Spread the love

To delete DataFrame row in Pandas based on column value, we put the condition of the items to return in the brackets.

For instance, we write

df = df[df.line_race != 0]

to return the df data frame values where the line_race column value isn’t 0 with

df[df.line_race != 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 *