I am trying to wrap my head around python. Basically I am trying to remove a duplicate string (a date to be more precise) in some data. So for example:
2019-03-31
2019-06-30
2019-09-30
2019-12-31
2020-03-31
2020-03-31
notice 2020-03-31 is duplicated. I would like to find the duplicated date and rename it as last quarter
conversely, If the data has no duplicates I want to leave as is.
I currently have some working code that checks to see if there are duplicates. And that is it. I just need some guidance in the right direction as to how to rename the duplicate.
def checkForDuplicates(listOfElems):
if len(listOfElems) == len(set(listOfElems)):
return
else:
return print("You have a duplicate")