Pythonnumpy.full(shape, fill_value, dtype =None,order = ‘ C ‘):返回一个形状和类型与fill_value填充的给定数组相同的新数组。
参数:
shape :Number of rows
order : C_contiguous or F_contiguous
dtype :[optional,float(byDefault)]Datatype of returned array.
fill_value :[bool, optional]Value to fill in the array.
Python
返回值:
ndarray
Python
示例1
# Python Programming illustrating# numpy.full methodimport 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)
Python
输出:
Matrix a :[[6767][6767]]Matrix c :[[10.110.110.1][10.110.110.1][10.110.110.1]]