I have a dataframe and I want to find the duplicates based on Color and Price. Then change the code with the code of the most recent(based on the Date) row. I don't want any row to be deleted. The dataframe is this:
id Color Price Code Date
1 White 1.50 111 3-22-2017 12:00
2 Green 2.20 222 3-23-2017 09:55
3 Black 3.00 333 3-24-2017 11:45
4 White 1.50 111 3-23-2017 10:20
5 White 1.50 444 3-23-2017 08:15
6 Green 2.20 555 3-25-2017 07:05
the result should be this:
id Color Price Code Date
1 White 1.50 111 3-22-2017 12:00
2 Green 2.20 **555** 3-23-2017 09:55
3 Black 3.00 333 3-24-2017 11:45
4 White 1.50 111 3-23-2017 10:20
5 White 1.50 **111** 3-23-2017 08:15
6 Green 2.20 555 3-25-2017 07:05
I know that the answer is close to the answer here but the form of the date confuses me.