I am trying to see if I can find duplicate records happened in the year
I know how to find when it is just the year but the date range and find the duplicate and remove the duplicate seems a bit tough. I am beginner so pleas can anyone help ?
>Solution :
You can use:
out = df[~df.loc[df['Date'].str.contains('2021')].duplicated(keep=False)
.reindex(df.index, fill_value=False)]
print(out)
# Output
Date Transaction
0 31/12/2020 PURCHASES
1 31/12/2020 Sales
2 31/12/2020 Sales