Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

numpy fancy indexing

import numpy as np
a = np.arange(0, 30, 3)
a
# array([ 0,  3,  6,  9, 12, 15, 18, 21, 24, 27])

[a[1], a[3], a[5]]
# [3, 9, 15]

fancy = [1, 3, 5]
a[fancy]
#array([ 3,  9, 15])
 
PREVIOUS NEXT
Tagged: #numpy #fancy #indexing
ADD COMMENT
Topic
Name
4+7 =