I have a data frame similar to this
name gender d1 d2 d3
dfd M F F F
adj F abc F F
dfdf F F df F
dfd NA F F dfd
daf F adf F F
for column d1, d2, d3, I want to convert all non-F value (abc, df, adf, dfd, and many others) into T.
my current code is:
for item in d1, d2, d3:
if item != F:
return 'T'
This would work, but it runs really long. Is there a pandas command that does this directly?