I have a dataframe like this:
id String
1 345 -456 -13 879
2 158 -926 -81 249 35 -4 -53 9
3 945 -506 -103
I want to sort it in desending order like this
id String
1 879 345 -13 -457
2 249 158 35 9 -4 -53 -81 -926
3 945 -103 -506
I tried this:
df['string'] = df['string'].str.split(' ').map(lambda x: ' '.join(sorted(x)))
The above function do some kind of sorting but not the way I want it.