drop_duplicates not working in pandas?
I have just had this issue, and this was not the solution.
It may be in the docs - I admittedly havent looked - and crucially this is only when dealing with date-based unique rows: the 'date' column must be formatted as such.
If the date
data is a pandas object dtype, the drop_duplicates
will not work - do a pd.to_datetime
first.
You've got inplace=False
so you're not modifying df
. You want either
df.drop_duplicates(subset=None, keep="first", inplace=True)
or
df = df.drop_duplicates(subset=None, keep="first", inplace=False)