Note
Numpy (44) 본문
728x90
How to sort a 2D array by a column
# Sort by column position 0: SepalLength
print(iris[iris[:,0].argsort()][:20])
[[b'4.3' b'3.0' b'1.1' b'0.1' b'Iris-setosa']
[b'4.4' b'3.2' b'1.3' b'0.2' b'Iris-setosa']
[b'4.4' b'3.0' b'1.3' b'0.2' b'Iris-setosa']
[b'4.4' b'2.9' b'1.4' b'0.2' b'Iris-setosa']
[b'4.5' b'2.3' b'1.3' b'0.3' b'Iris-setosa']
[b'4.6' b'3.6' b'1.0' b'0.2' b'Iris-setosa']
[b'4.6' b'3.1' b'1.5' b'0.2' b'Iris-setosa']
[b'4.6' b'3.4' b'1.4' b'0.3' b'Iris-setosa']
[b'4.6' b'3.2' b'1.4' b'0.2' b'Iris-setosa']
[b'4.7' b'3.2' b'1.3' b'0.2' b'Iris-setosa']
[b'4.7' b'3.2' b'1.6' b'0.2' b'Iris-setosa']
[b'4.8' b'3.0' b'1.4' b'0.1' b'Iris-setosa']
[b'4.8' b'3.0' b'1.4' b'0.3' b'Iris-setosa']
[b'4.8' b'3.4' b'1.9' b'0.2' b'Iris-setosa']
[b'4.8' b'3.4' b'1.6' b'0.2' b'Iris-setosa']
[b'4.8' b'3.1' b'1.6' b'0.2' b'Iris-setosa']
[b'4.9' b'2.4' b'3.3' b'1.0' b'Iris-versicolor']
[b'4.9' b'2.5' b'4.5' b'1.7' b'Iris-virginica']
[b'4.9' b'3.1' b'1.5' b'0.1' b'Iris-setosa']
[b'4.9' b'3.1' b'1.5' b'0.1' b'Iris-setosa']]
'Numpy' 카테고리의 다른 글
Numpy (46) (0) | 2022.09.12 |
---|---|
Numpy (45) (0) | 2022.09.11 |
Numpy (43) (0) | 2022.09.07 |
Numpy (42) (0) | 2022.09.06 |
Numpy (41) (0) | 2022.09.04 |
Comments