The numpy.fromfunction makes a single call to the function with arguments as arrays, as described in e.g. this answer. So to use numpy.fromfunction it is required that the function takes array arguments and return an array also.
How to make numpy array based on function called for each element, where the function returns a scalar for the element, as for example using the max
function like below ?
z = numpy.fromfunction(max, (2, 2), dtype=int)
Which would then return:
[[0 1]
[1 1]]