drop duplicate based on column length
First, sort the data set by the length of "Employee History". Then insert every row into a OrderedDict using the "Company ID" as key and other columns as value. Finally, restore the dict to table.
Note: from python 3.7, regular dicts are guaranteed to be ordered, too.
I need to drop duplicate based on the length of the column "Employee History". The column with the longest length should be kept
Note: (there are many, many more columns, but this is the 2 columns that matter for this case)





Company ID
Employee History






253
462106-27
2021: 21, 2022: 26




264
181831-33
2019: 20, 2020: 60, 2021: 172, 2022: 225




338
181831-33
2019: 20, 2020: 60, 2021: 172




3481
462106-27
2021: 21