我有一个带形状的麻木数组(n,9)。
例如:
[[1579.0, 483.0, 1949.0, 407.0, 1959.0, 454.0, 1589.0, 531.0, 0.33],
[1613.0, 1115.0, 1995.0, 1093.0, 1998.0, 1137.0, 1616.0, 1159.0, 0.16],
[904.0, 1417.0, 1068.0, 1420.0, 1067.0, 1461.0, 904.0, 1458.0, 0.31],
[1583.0, 479.0, 1950.0, 401.0, 1961.0, 452.0, 1593.0, 530.0, 0.33],
[1604.0, 482.0, 1943.0, 407.0, 1954.0, 454.0, 1614.0, 530.0, 0.13],
[908.0, 1418.0, 1064.0, 1421.0, 1064.0, 1458.0, 907.0, 1456.0, 0.21]]
我想根据每行中的第一个数字对这个数组进行排序。换言之,基于第二维度的firs数。
结果应该是:
[[904.0, 1417.0, 1068.0, 1420.0, 1067.0, 1461.0, 904.0, 1458.0, 0.31],
[908.0, 1418.0, 1064.0, 1421.0, 1064.0, 1458.0, 907.0, 1456.0, 0.21]
[1579.0, 483.0, 1949.0, 407.0, 1959.0, 454.0, 1589.0, 531.0, 0.33],
[1583.0, 479.0, 1950.0, 401.0, 1961.0, 452.0, 1593.0, 530.0, 0.33],
[1604.0, 482.0, 1943.0, 407.0, 1954.0, 454.0, 1614.0, 530.0, 0.13],
[1613.0, 1115.0, 1995.0, 1093.0, 1998.0, 1137.0, 1616.0, 1159.0, 0.16]
]
我怎么能用蟒蛇做这个呢