numpy.empty() in Python

The empty() method of Python numpy class returns a new array of the specified shape and type, without initializing the entries.



The numpy.empty method consists of three parameters, which are as follows:

shape : This parameter represents the number of rows

order : The order parameter can be either C_contiguous or F_contiguous.

dtype : It is an optional parameter. It depicts the data type of returned array, and by default, it is a float.

Return Value

This method returns a new array of given shape and type by taking random values.

Example 1


Example 2


Pin It on Pinterest

Share This