Delete all rows contained in a dataframe, as specified by an array of ids

Using

ids = findall(nonunique(mydata))

I have found the ids of all rows that are duplicates. Now, I want to clean mydata by erasing the duplicate rows.

How is that done?

Here is one approach:

df = df[Not(ids), :]

1 Like

Or

df = unique(df)
4 Likes

To do the same by modifying the existing dataframe:

delete!(df, ids)

or directly with the boolean array

delete!(df, nonunique(df))

or simply

unique!(df)
1 Like