Reputation: 67
I have data set like this,
S.No. Counts No.rep Fram
1 3 4 UNC84A
2 10 4 UNC84A
3 7 4 UNC84A
4 10.3 4 UNC84A
5 7 1 NTUD19
6 181 3 ALR6IP4
7 7 3 ALR6IP4
8 21 3 ALR6IP4
I would like to filter "if No.rep>=3" then select column which has "Counts>= 10". Also, when No.rep < 3, I would required to have columns with Counts < 10 as well.
This is my required output
S.No. Counts No.rep Fram
2 10 4 UNC84A
4 10.3 4 UNC84A
5 7 1 NTUD19
6 181 3 ALR6IP4
8 21 3 ALR6IP4
Upvotes: 0
Views: 132
Reputation: 34291
You can try:
df[df["No.rep"] >= 3 & df["Counts"] >= 10,]
S.No. Counts No.rep Fram
2 10.0 4 UNC84A
4 10.3 4 UNC84A
6 181.0 3 ALR6IP4
8 21.0 3 ALR6IP4
EDIT:
Do you want an OR condition like so:
df[(df["No.rep"] >= 3 & df["Counts"] >= 10) | (df["No.rep"] < 3 & df["Counts"] < 10),]
S.No. Counts No.rep Fram
2 10.0 4 UNC84A
4 10.3 4 UNC84A
5 7.0 1 NTUD19
6 181.0 3 ALR6IP4
8 21.0 3 ALR6IP4
Upvotes: 3