get first row of numpy array code example
Example 1: print column in 2d numpy array
import numpy as np
x=np.arange(25).reshape(5,5)
print(x)
#print(x[:,index_of_column_you_need])
print(x[:,3])
Example 2: how to get the first few lines of an ndarray
In [11]: a[:,:2]
Out[11]:
array([[-0.57098887, -0.4274751 ],
[-0.22279713, -0.51723555],
[ 0.67492385, -0.69294472],
[ 0.41086611, 0.26374238]])