In my JSON array, I have entries like this:
daysdif = [{
"EmployeeID": "213654654",
"DaysDiff": "NaN"
}, {
"EmployeeID": "String",
"DaysDiff": "NaN"
}, {
"EmployeeID": "6021240",
"DaysDiff": "-63.30"
}, {
"EmployeeID": "6011327",
"DaysDiff": "-35.67"
}, {
"EmployeeID": "883",
"DaysDiff": "-63.40"
}, {
"EmployeeID": "1183",
"DaysDiff": "-70.13"
}, {
"EmployeeID": "1240",
"DaysDiff": "-70.97"
}, {
"EmployeeID": "2293",
"DaysDiff": "-63.30"
}, {
"EmployeeID": "5001839",
"DaysDiff": "-8.47"
}, {
"EmployeeID": "3395",
"DaysDiff": "-68.00"
}, {
"EmployeeID": "2473",
"DaysDiff": "-66.20"
}, {
"EmployeeID": "1075",
"DaysDiff": "-70.17"
}, {
"EmployeeID": "2947",
"DaysDiff": "-69.10"
}, {
"EmployeeID": "5002196",
"DaysDiff": "-4.97"
}, {
"EmployeeID": "1688",
"DaysDiff": "-67.40"
}, {
"EmployeeID": "2031",
"DaysDiff": "-54.07"
}, {
"EmployeeID": "1484",
"DaysDiff": "-69.17"
}, {
"EmployeeID": "1022",
"DaysDiff": "-69.40"
}]
Among the entries, there are duplicates with the same 'EmployeeID' but different 'DaysDiff' values. For example:
[{
"EmployeeID": "5001839",
"DaysDiff": "-8.47"
}, {
"EmployeeID": "5001839",
"DaysDiff": "-22.20"
}, {
"EmployeeID": "5001839",
"DaysDiff": "-23.77"
}, {
"EmployeeID": "5001839",
"DaysDiff": "-41.67"
}, {
"EmployeeID": "5001839",
"DaysDiff": "-63.97"
}]
I am looking to keep only the entry with the highest 'DaysDiff' value for each duplicate 'EmployeeID'. In this case, it would be '-8.47' and remove the other duplicate entries.