Difference between frompyfunc and vectorize in numpy

后端 未结 3 1580
夕颜
夕颜 2020-12-14 07:01

What is the difference between vectorize and frompyfunc in numpy?

Both seem very similar. What is a typical use case for each of them?

Edit:

3条回答
  •  無奈伤痛
    2020-12-14 07:25

    I'm not sure what the different use cases for each is, but if you look at the source code (/numpy/lib/function_base.py), you'll see that vectorize wraps frompyfunc. My reading of the code is mostly that vectorize is doing proper handling of the input arguments. There might be particular instances where you would prefer one vs the other, but it would seem that frompyfunc is just a lower level instance of vectorize.

提交回复
热议问题