Does anybody know how I can change my code so that it only displays values of 1 or 0 for each row in my dataframe for biasA and biasB (shown in the screenshot) - by this I mean no values of 0 and 0 for biasA and biasB. I have attempted to do this on the df1 line, and I have searched online and have not found anything. If anyone could let me know ASAP it would be great.
Asked
Active
Viewed 47 times
0
-
Please post code and any errors as text, not image. – ewokx Aug 06 '20 at 23:55
-
Please read [Under what circumstances may I add “urgent” or other similar phrases to my question, in order to obtain faster answers?](//meta.stackoverflow.com/q/326569) - the summary is that this is not an ideal way to address volunteers, and is probably counterproductive to obtaining answers. Please refrain from adding this to your questions. – halfer Aug 08 '20 at 17:56
1 Answers
2
Can use
df[(df.biasA==1)|(df.biasB==1)]
or
df[(df.biasA.eq(1))|(df.biasB.eq(1))]

wwnde
- 26,119
- 6
- 18
- 32
-
`df[(df.biasA.eq(1))|(df.biasB.eq(1))]` will get you 1 and 1 if it exists. If you only need 1 and 1 please try `df[(df.biasA.eq(1))&(df.biasB.eq(1))]` – wwnde Aug 07 '20 at 00:13
-