numpy.full()

numpy.full()

Python numpy.full(shape, fill_value, dtype =None,order = ‘ C ‘):返回一个形状和类型与fill_value填充的给定数组相同的新数组。

参数:

shape      : Number of rows
order      : C_contiguous or F_contiguous
dtype      : [optional, float(by Default)] Data type of returned array.  
fill_value : [bool, optional] Value to fill in the array.

返回值:

ndarray

示例1

# Python Programming illustrating
# numpy.full method
  
import numpy as geek
  
a = geek.full([2, 2], 67, dtype = int)
print("\nMatrix a : \n", a)
  
c = geek.full([3, 3], 10.1)
print("\nMatrix c : \n", c)

输出:


Matrix a : [[67 67] [67 67]] Matrix c : [[ 10.1 10.1 10.1] [ 10.1 10.1 10.1] [ 10.1 10.1 10.1]]

Python教程

Java教程

Web教程

数据库教程

图形图像教程

大数据教程

开发工具教程

计算机教程