I have a data frame with counts of different kinds of fruits of different people. Like below
apple banana orange Tim 3 0 2 Tom 0
I usually use this approach:
df[df > 0] = 1