numpy.full() in Python

The full() method of Python numpy class returns a new array of specified shape and type, filled with fill_value.

Syntax

Parameter

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.

fill_value :It represents the value to fill in the array. It is an optional parameter, by default it is Boolean.

Return

This method returns a new array with the same shape and type as a given array that is filled with fill_value.

Example 1

Output

First Matrix :

Second Matrix :

Pin It on Pinterest

Share This