Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

numpy apply function to array

import numpy as np

arr = np.array([1,2,3,4])
print(np.apply_along_axis(lambda x : x ** 2, 0, arr))

#Output: array([ 1,  4,  9, 16])
 
PREVIOUS NEXT
Tagged: #numpy #apply #function #array
ADD COMMENT
Topic
Name
6+9 =