xinihe / jrxy_python_course

Python in Finance
72 stars 316 forks source link

question #10

Open leo8668 opened 4 years ago

leo8668 commented 4 years ago

为什么经过列的顺序排列之后,矩阵的形式还是和根据行排序后相同的[[3,7] [1,9]],应该是不同的吧 x = np.array([[3,7],[9,1]])
print ('原始数组是:') print (x) print ('\n') print ('按行排序:') print (np.sort(x, axis = 1)) print ('\n') print ('按列排序:') print (np.sort(x))

happy-mint commented 4 years ago

按列排序 np.sort(x, axis=0)

leo8668 commented 4 years ago

谢谢老师