numpy.fromfunction() function – Python Last Updated : 29 Aug, 2020 Comments Improve Suggest changes Like Article Like Report numpy.fromfunction() function construct an array by executing a function over each coordinate and the resulting array, therefore, has a value fn(x, y, z) at coordinate (x, y, z). Syntax : numpy.fromfunction(function, shape, dtype) Parameters : function : [callable] The function is called with N parameters, where N is the rank of shape. Each parameter represents the coordinates of the array varying along a specific axis. shape : [(N, ) tuple of ints] Shape of the output array, which also determines the shape of the coordinate arrays passed to function. dtype : [data-type, optional] Data-type of the coordinate arrays passed to function. Return : The output array. Code #1 : Python3 # Python program explaining # numpy.fromfunction() function # importing numpy as geek import numpy as geek gfg = geek.fromfunction(lambda i, j: i * j, (4, 4), dtype = float) print(gfg) Output : [[0. 0. 0. 0.] [0. 1. 2. 3.] [0. 2. 4. 6.] [0. 3. 6. 9.]] Code #2 : Python3 # Python program explaining # numpy.fromfunction() function # importing numpy as geek import numpy as geek gfg = geek.fromfunction(lambda i, j: i == j, (3, 3), dtype = int) print(gfg) Output : [[ True False False] [False True False] [False False True]] Comment More infoAdvertise with us Next Article numpy.fromfunction() function – Python S sanjoy_62 Follow Improve Article Tags : Python Python-numpy Practice Tags : python Similar Reads numpy.fromstring() function â Python numpy.fromstring() function create a new one-dimensional array initialized from text data in a string. Syntax : numpy.fromstring(string, dtype = float, count = -1, sep = ' ') Parameters : string : [str] A string that contained the data. dtype : [data-type, optional] Data-type of the array. Default d 1 min read numpy.fromiter() function â Python NumPy's fromiter() function is a handy tool for creating a NumPy array from an iterable object. This iterable can be any Python object that provides elements one at a time. The function is especially useful when you need to convert data from a custom data source, like a file or generator, into a Num 2 min read numpy.frombuffer() function â Python numpy.frombuffer() function interpret a buffer as a 1-dimensional array. Syntax : numpy.frombuffer(buffer, dtype = float, count = -1, offset = 0) Parameters : buffer : [buffer_like] An object that exposes the buffer interface. dtype : [data-type, optional] Data-type of the returned array, default da 1 min read numpy.frompyfunc() in Python numpy.frompyfunc(func, nin, nout) function allows to create an arbitrary Python function as Numpy ufunc (universal function). Parameters: func: [A python function object ] An arbitrary python function nin: [int] Number of input arguments to that function. nout: [int] Number of objects returned by th 2 min read numpy.i0() function | Python numpy.i0() function is the modified Bessel function of the first kind, order 0. it's usually denoted by I0. Syntax : numpy.i0(x) Parameters : x : [array_like, dtype float or complex] Argument of the Bessel function. Return : [ndarray, shape = x.shape, dtype = x.dtype] The modified Bessel function ev 1 min read Like