0
How would you get only the un-duplicated lines of a dataframe? Without them being single records, so df.unique()
would not fit here. Only the ones that exist 1 same.
I tried that way, but I don’t know if it’s right.
df2 = DF
df2.drop_duplicates('userId', keep=False, inplace=True)
So I would use the df2
where all those that are not duplicated would remain. This form is correct?
The right thing would be without the
(..., inplace=True)
?– Luciano Amaro
Exact, and preferably without the
df2 = DF
at the beginning also, which loses use. Theinplace=True
makes the operation happen directly in the dataframe in which it is called, while without it the operation is done in a copy, which is returned by the function after.– GBrandt