Answers for "numpy select columns by index"

4

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])
Posted by: Guest on November-19-2020
0

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]])
Posted by: Guest on August-11-2020

Code answers related to "numpy select columns by index"

Python Answers by Framework

Browse Popular Code Answers by Language