Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Trouble with Sort
#1
I am having trouble getting sort to work.

Here is the code

def load_track_to_Handi():
	my_tracklabel= Label(root, text ="                                                                               ", fg= "#F50808", font = ("sans_serif" , 16)).place(x=380, y=430)
	read_csvfile_into_array()
	
		
	global track_abrev
	global race_number
	
	
	#if fileFound ==True:

		
		
	
	x=[]
	xx = []
	hcount = 0
	
	with open( 'C://guis/f_racefiles/'+ track_abrev + '.csv' , 'r') as race_file:

		#csv_reader = csv.reader(race_file) 
		#for line in race_file: 
			#print(line)
		df = pd.read_csv(race_file, header =None)
		for i in df:
			x= np.array(df.iloc[hcount, 17:18])
			xx = (hcount,int(x))
			#print (xx)
			hcount+=1
			print(xx)
		
		np.sort(x, axis=1)
Here is what I get. I want to sort the 2nd column....

(0, 3)
(1, 10)
(2, 8)
(3, 12)
(4, 2)
(5, 1)
(6, 4)
(7, 8)
(8, 10)
(9, 1)
(10, 1)
(11, 6)
(12, 10)
(13, 4)
(14, 3)
(15, 5)
(16, 2)
(17, 12)
(18, 4)
(19, 4)
(20, 10)
(21, 6)
(22, 12)
(23, 6)
(24, 3)
(25, 15)
(26, 2)
(27, 5)
(28, 4)
(29, 2)
(30, 10)
(31, 2)
(32, 20)
(33, 6)
(34, 3)
(35, 3)
(36, 4)
(37, 12)
(38, 6)
(39, 4)
(40, 10)
(41, 10)
(42, 4)
(43, 6)
(44, 3)
(45, 30)
(46, 10)
(47, 12)
(48, 3)
(49, 8)
(50, 6)
(51, 4)
(52, 10)
(53, 6)
(54, 30)
(55, 5)
(56, 6)
(57, 10)
(58, 10)
(59, 20)
(60, 8)
(61, 6)
(62, 15)
(63, 12)


Thank you.
Reply


Messages In This Thread
Trouble with Sort - by Milfredo - Sep-13-2020, 10:14 AM
RE: Trouble with Sort - by Askic - Sep-13-2020, 10:51 AM
RE: Trouble with Sort - by Milfredo - Sep-13-2020, 06:50 PM
RE: Trouble with Sort - by scidam - Sep-14-2020, 12:44 AM
RE: Trouble with Sort - by Milfredo - Sep-14-2020, 04:12 AM
RE: Trouble with Sort - by Askic - Sep-14-2020, 05:50 AM
RE: Trouble with Sort - by Milfredo - Sep-14-2020, 06:56 AM
RE: Trouble with Sort - by Askic - Sep-14-2020, 02:21 PM
RE: Trouble with Sort - by Milfredo - Sep-14-2020, 02:37 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
Photo a.sort() == b.sort() all the time 3lnyn0 1 1,324 Apr-19-2022, 06:50 PM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020