I am new at python and numpy. Consider that I have a function called addTwo that just returns the given value + 2. My question is what's the difference between np.vectorize(addTwo )(matrix) and addTwo (matrix). both give me the same output. Basically my question is: if I have following code:
import numpy as np
def addTwo(a):
return a + 2
matr = np.array([[1, 2], [2, 3], [3, 4]])
I wonder difference between these two:
addTwo(matr)
np.vectorize(addTwo)(matr)