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
# 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]]
相關用法
注:本文由純淨天空篩選整理自 numpy.full() in Python。非經特殊聲明,原始代碼版權歸原作者所有,本譯文未經允許或授權,請勿轉載或複製。