Issue
I would like to change so True = False
or more exact change so True = 0
and False = 1
is there a way to do this?
I have a dataframe
and would like to df.groupby('country',as_index=False).sum()
and see how many False
values there is in each country
I have tried df['allowed'] = --df['allowed']
(allowed is the column with True
and False
values) to swap them but it didn't work
Solution
Swapping booleans is easy with df["neg_allowed"] = ~df['allowed']
Answered By - nthtry
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.