Data set we have is here.
a=np.array([2,6,9,5])
b =np.array([0.5,3,1,4])
what I'm looking for is (sorted data points by a)
a=np.array([2,5,6,9])
b =np.array([0.5,4,3,1])
The code I've been trying and gives me an error
If you can teach me the error, it would be very appreciable. I search answers for this, but I couldn't find out. Thank you so much in advance.
import numpy as np
a=np.array([2,6,9,5])
b =np.array([0.5,3,1,4])
#transpose data points
datatemp = np.array([a, b]).T
data=sorted(datatemp, key=itemgetter(0))
a=data[:,0]
b=data[:,1]
print(a)
print(b)