I have a dataset as follows: I am going to filter rows where the counts value equals 1.
index count
1 4
2 5
3 1
4 1
This is my code:
booleans =[]
for number in df1.count:
if number ==1:
booleans.append (True)
else:
booleans.append (False)
but it has this error:
'method' object is not iterable
I also tried this:
df[df.count==1]
but I had the following error:
KeyError: False
any suggestion?