-1

the data: consider this sample dataset https://docs.google.com/spreadsheets/d/17Xjc81jkjS-64B4FGZ06SzYDRnc6J27m/edit#gid=1176233701

How to delete rows rows based on multiple columns condition?

i am filtering the data based on my thread i asked earlier. How to filter this dataframe? The solution in this thread ended up with errors

I want to filter the data based on the Edit section in the above thread?

mathew
  • 59
  • 6

1 Answers1

0

You can combine filters using the & operator, like so:

# Dataframe with random values in range [0, 100] with shape [100,4]
df = pd.DataFrame(np.random.randint(0,100,size=(100, 4)), columns=list('ABCD'))

# Example filters
filter1 = df['A'] > 10
filter2 = df['B'] > 90
filter3 = df['C'] > df['D']

# Filter/remove rows
df[filter1 & filter2 & filter3]

OUTPUT:
    A   B   C   D
0   51  92  73  36
17  73  95  77  20
91  88  95  79  54
95  68  99  68  40
ViggoTW
  • 36
  • 8