this is not the place for this. You should checkout pandas

import pandas as pd

df = pd.read_csv('~/Downloads/sort_savin.txt', sep=' ', 
header=None).sort_values(by=1)


On Wednesday, 18 December 2019 17:09:04 UTC+1, Savin Beniwal wrote:
>
> Hi all
> After spending many hours on Google, I came here to get your suggestions 
> regarding the following query:
>
> I have a text file of five columns. I want to sort the second column 
> (ascending order) by keeping the other column adjust itself as per original 
> one entity of 2nd column. I'm able to sort only one column in python but 
> not able to keep the other column adjust itself.
> I need the output as shown below:
> 2 0.1 0.5 6 0
> 1 0.2 0.5 4 5
> 3 0.8 0.2 5 2
> 5 0.8 0.2 5 2
> 5 2.0 0.2 3 5
> 8 3.0 0.9 3 6
>
>
> Thank you for your time and reply (in advance).
>

-- 
You received this message because you are subscribed to the Google Groups 
"spyder" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/spyderlib/67a8b6e5-0a7c-40c9-9417-9268c7d4dc1f%40googlegroups.com.

Reply via email to