Answers for "select columns in numpy array"

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
1

extract column numpy array python

# Extract/ Slice only the 3rd column from the numpy array
print(a2[:,[2]])
Posted by: Guest on October-16-2020
0

select a column of numpy array

test = numpy.array([
  [1, 2], [3, 4], [5, 6]
])

>>> test[:,0]
array([1, 3, 5])

>>> test[:,[0]]
array([[1],
       [3],
       [5]])
Posted by: Guest on June-13-2021
0

access to specific column array numpy

second_and_third_column = an_array[:, 1:3]
Posted by: Guest on December-29-2020

Code answers related to "select columns in numpy array"

Python Answers by Framework

Browse Popular Code Answers by Language