Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

numpy indexing arrays

import numpy as np

# create numpy array
arr = np.array([1, 2, 3, 4, 5])

# first element of array
print('1st element of array arr[0]: ', arr[0])

# 2d array
arr = np.array([[1, 2, 3, 4, 5], [6, 7, 8, 9, 10]])
print('2nd element on 1st row: ', arr[0, 1])
Source by codefreelance.net #
 
PREVIOUS NEXT
Tagged: #numpy #indexing #arrays
ADD COMMENT
Topic
Name
2+4 =