I have a large dataframe in the following format :
name ingredient colour similarity ids city country proba
pesto ba g 0.93 4 ve it 0.85
pesto sa p 0.93 3 to ca 0.92
pesto li y 0.99 6 lo en 0.81
pasta fl w 0.88 2 de in 0.8
pasta wa b 0.93 1 da te 0.84
egg eg w 1 5 ro ja 0.99
I want to rank all of the name by their similarity (higher similarity would have a higher rank and if 2 rows have the same similarity then the order at which they're appended doesn't matter) and then merge all of the duplicated rows together
the output would look like the following:
name ingredient colour similarity ids city country proba
pesto ['li', 'ba', 'sa'] ['y', 'g', 'p'] [0.99, 0.93, 0.93] [6, 4, 3] ['lo', 've', 'to'] ['en', 'it', 'ca'] [0.81, 0.85, 0.92]
pasta ['wa', 'fl'] ['b', 'w'] [0.93, 0.88] [1, 2] ['da', 'de'] ['te', 'in'] [0.84, 0.8]
egg ['eg'] ['w'] [1] [5] ['ro'] ['ja'] [0.99]