Reputation: 20139
Suppose I have a dataframe df
such as
A B C
0 a 1
1 b 1
2 c 2
I would like to return B
, and C
when C==1
, like so
B C
a 1
b 1
I've got as far as df.B[df.C==1]
, which returns
B
a
b
which is right (countwise) but wrong in the slice. How do I get C
?
Upvotes: 4
Views: 9220