numpy.empty() in Python Last Updated : 29 Nov, 2018 Comments Improve Suggest changes Like Article Like Report numpy.empty(shape, dtype = float, order = 'C') : Return a new array of given shape and type, with random values. Parameters : -> shape : Number of rows -> order : C_contiguous or F_contiguous -> dtype : [optional, float(by Default)] Data type of returned array. Python # Python Programming illustrating # numpy.empty method import numpy as geek b = geek.empty(2, dtype = int) print("Matrix b : \n", b) a = geek.empty([2, 2], dtype = int) print("\nMatrix a : \n", a) c = geek.empty([3, 3]) print("\nMatrix c : \n", c) Output : Matrix b : [ 0 1079574528] Matrix a : [[0 0] [0 0]] Matrix a : [[ 0. 0. 0.] [ 0. 0. 0.] [ 0. 0. 0.]] Note : empty, unlike zeros, does not set the array values to zero, and may therefore be marginally faster. Also, these codes won’t run on online-ID. Please run them on your systems to explore the working Comment More infoAdvertise with us Next Article numpy.empty() in Python M Mohit Gupta_OMG Improve Article Tags : Python Python-numpy Python numpy-arrayCreation Practice Tags : python Similar Reads numpy.any() in Python The numpy.any() function tests whether any array elements along the mentioned axis evaluate to True. Syntax : numpy.any(a, axis = None, out = None, keepdims = class numpy._globals._NoValue at 0x40ba726c) Parameters : array :[array_like]Input array or object whose elements, we need to test. axis : 3 min read numpy.matlib.empty() function | Python numpy.matlib.empty() function return a new matrix of given shape and type, without initializing entries. Syntax : numpy.matlib.empty(shape, dtype = None, order = 'C') Parameters : shape : [int or tuple of int] Shape of the empty matrix. dtype : [data-type, optional] Desired output data-type. order : 1 min read numpy.isnan() in Python The numpy.isnan() function tests element-wise whether it is NaN or not and returns the result as a boolean array. Syntax : numpy.isnan(array [, out]) Parameters : array : [array_like]Input array or object whose elements, we need to test for infinity out : [ndarray, optional]Output array placed wit 2 min read Python | Numpy np.legzero() method np.legzero() method can be used instead of np.zeros for creating a array whose elements are 0. Syntax : np.legzero() Return : Return array([0]) Example #1 : Python3 1=1 # Python program explaining # numpy.legzero() method # import numpy and legzero import numpy as np from numpy.polynomial.legendre i 1 min read Null in Python In Python, None represents the absence of a value and is the only instance of the NoneType. It's often used as a placeholder for variables that don't hold meaningful data yet. Unlike 0, "" or [], which are actual values, None specifically means "no value" or "nothing." Example:Pythona = None if a is 3 min read Like