I don\'t understand the behavior below. numpy arrays can generally be accessed through indexing, so [:,1] should be equivalent to [:][1], or so I thought. Could someone explain
>>> a = np.array([[1, 2, 3], [4, 5, 6]])
>>> a[:,1]
array([2, 5])
you select the second dimension (column of your matrix) and take the element 1 in this dimension. the same way, a[:,0]
selects the first column, here array([1,4])
, a[:,2]
the third column.
As was previously said, a[:]
copies your list (be a numpy array or a list).