Python Forum
Drop rows if a set of columns has a value
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Drop rows if a set of columns has a value
#1
Hi,
I am looking for a way in pandas to do the following:

First lets assume a data frame with the following columns

small_df=df[['1','2','3','4','5','dist','unique']]
then I would like to

drop any row if any of the columns 1,2,3,4,5 contains 100 or 101?

How I can combine all those conditions together?

Thanks a lot
Regards
Alex
Reply


Messages In This Thread
Drop rows if a set of columns has a value - by dervast - Sep-06-2019, 01:45 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Merging rows and adding columns based on matching index pythonnewbie78 3 753 Dec-24-2023, 11:51 AM
Last Post: Pedroski55
  read_csv error and rows/columns missing karlito 9 5,232 Nov-11-2019, 06:48 AM
Last Post: karlito
  drop rows that doesnt matched karlito 6 2,992 Oct-28-2019, 12:21 PM
Last Post: karlito
  display graph in columns and rows william888 1 1,825 Jul-02-2019, 10:19 AM
Last Post: dataman
  Drop rows from data with zero value Devilish 3 3,697 Dec-27-2018, 02:06 AM
Last Post: Devilish
  Dropping all rows of multiple columns after the max of one cell Thunberd 2 2,919 Jun-01-2018, 10:18 PM
Last Post: Thunberd
  Get rows with same value from dataframe of particular columns angelwings 1 2,710 Apr-11-2018, 02:40 AM
Last Post: scidam
  summing rows/columns more quickly jon0852 3 2,855 Feb-12-2018, 02:24 AM
Last Post: ka06059
  Stack dataframe columns into rows klllmmm 0 3,008 Sep-03-2017, 02:26 AM
Last Post: klllmmm

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020