Answers for "numpy apply function to array"

-1

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])
Posted by: Guest on April-23-2020

Code answers related to "numpy apply function to array"

Python Answers by Framework

Browse Popular Code Answers by Language