Numpy中花式索引

x = numpy.array([1,2,3,4,5,6]) print x[[0,1,2]] # [1 2 3] print x[[-1,-2,-3]] # [6,5,4] x = numpy.array([[1,2],[3,4],[5,6]]) print x[[0,1]] # [[1,2],[3,4]] print x[[0,1],[0,1]] # [1,4] 打印x[0][0]和x[1][
相關文章
相關標籤/搜索