How to use numpy.frompyfunc to return an array of elements instead of array of arrays?
问题 I am using the PLegendre function from the SHTOOLS package. It returns an array of Legendre polynomials for a particular argument. PLegendre(lmax,x) returns an array of Legendre polynomials P_0(x) to P_lmax(x). It works like this: In [1]: from pyshtools import PLegendre loading shtools documentation In [2]: import numpy as np In [3]: PLegendre(3,0.5) Out[3]: array([ 1. , 0.5 , -0.125 , -0.4375]) I would like to pass an array as a parameter, so I use frompyfunc. In [4]: legendre=np.frompyfunc