Most efficient way to map function over numpy array

前端 未结 11 1348
庸人自扰
庸人自扰 2020-11-22 02:13

What is the most efficient way to map a function over a numpy array? The way I\'ve been doing it in my current project is as follows:

import numpy as np 

x          


        
11条回答
  •  遥遥无期
    2020-11-22 02:41

    Use numpy.fromfunction(function, shape, **kwargs)

    See "https://docs.scipy.org/doc/numpy/reference/generated/numpy.fromfunction.html"

提交回复
热议问题