Skip to content

Latest commit

 

History

History
29 lines (23 loc) · 629 Bytes

how-to-get-column-from-numpy-array.md

File metadata and controls

29 lines (23 loc) · 629 Bytes

How to get specific row from Numpy array

import numpy as np
arr = np.array([[1, 2], [3, 4]])
row = arr[1,:]
  • import numpy as np - load lib:Numpy module for Python
  • [[1, 2], [3, 4]] - sample matrix data (2-dimensional array)
  • np.array - declare Numpy array
  • arr - variable contains array
  • [1,:] - return second row (index number is 1) of the specified matrix

group: get_row

Example:

import numpy as np
arr = np.array([[1, 2], [3, 4]])
row = arr[1,:]
print(row)
[3 4]

link_youtube: https://youtu.be/ee4NsGO-0g0