If I have this pandas v1.3.4 dataframe:
index col1 col2
1 ['1','2','3'] 'a'
2 ['2','4','2'] 'b'
3 ['5','2','1'] 'c'
4 ['3','2','1'] 'd'
How can I sort each value in col1 without changing the index or any other values (col2 in this case)? For this example, if I sort from lowest to highest (assuming lexographic sorting matched the numerical sorting) I would get:
index col1 col2
1 ['1','2','3'] 'a'
2 ['2','2','4'] 'b'
3 ['1','2','5'] 'c'
4 ['1','2','3'] 'd'
I don't particularly care what sorting approach I take, I just want lists with the same items to have the same order so they are recognised as equivalent, for some downstream data visualisation.
Thanks!
Tim