国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁(yè) > 編程 > Python > 正文

python中numpy.zeros(np.zeros)的使用方法

2020-02-16 10:35:28
字體:
來(lái)源:轉(zhuǎn)載
供稿:網(wǎng)友

翻譯:

用法:zeros(shape, dtype=float, order='C')

返回:返回來(lái)一個(gè)給定形狀和類型的用0填充的數(shù)組;

參數(shù):shape:形狀

dtype:數(shù)據(jù)類型,可選參數(shù),默認(rèn)numpy.float64

dtype類型:

t ,位域,如t4代表4位

b,布爾值,true or false

i,整數(shù),如i8(64位)

u,無(wú)符號(hào)整數(shù),u8(64位)

f,浮點(diǎn)數(shù),f8(64位)

c,浮點(diǎn)負(fù)數(shù),

o,對(duì)象,

s,a,字符串,s24

u,unicode,u24

order:可選參數(shù),c代表與c語(yǔ)言類似,行優(yōu)先;F代表列優(yōu)先

例子:

np.zeros(5)array([ 0., 0., 0., 0., 0.])np.zeros((5,), dtype=np.int)array([0, 0, 0, 0, 0])np.zeros((2, 1))array([[ 0.],    [ 0.]])s = (2,2)np.zeros(s)array([[ 0., 0.],    [ 0., 0.]])np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')]) # custom dtypearray([(0, 0), (0, 0)],   dtype=[('x', '<i4'), ('y', '<i4')])########################################################zeros(shape, dtype=float, order='C')Return a new array of given shape and type, filled with zeros.Parameters----------shape : int or sequence of ints  Shape of the new array, e.g., ``(2, 3)`` or ``2``.dtype : data-type, optional  The desired data-type for the array, e.g., `numpy.int8`. Default is  `numpy.float64`.order : {'C', 'F'}, optional  Whether to store multidimensional data in C- or Fortran-contiguous  (row- or column-wise) order in memory.Returns-------out : ndarray  Array of zeros with the given shape, dtype, and order.See Also--------zeros_like : Return an array of zeros with shape and type of input.ones_like : Return an array of ones with shape and type of input.empty_like : Return an empty array with shape and type of input.ones : Return a new array setting values to one.empty : Return a new uninitialized array.Examples--------np.zeros(5)array([ 0., 0., 0., 0., 0.])np.zeros((5,), dtype=np.int)array([0, 0, 0, 0, 0])np.zeros((2, 1))array([[ 0.],    [ 0.]])s = (2,2)np.zeros(s)array([[ 0., 0.],    [ 0., 0.]])np.zeros((2,), dtype=[('x', 'i4'), ('y', 'i4')]) # custom dtypearray([(0, 0), (0, 0)],   dtype=[('x', '<i4'), ('y', '<i4')])Type:   builtin_function_or_method

以上這篇python中numpy.zeros(np.zeros)的使用方法就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持武林站長(zhǎng)站。

發(fā)表評(píng)論 共有條評(píng)論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 鸡泽县| 东安县| 桐柏县| 光山县| 舒城县| 郎溪县| 涟源市| 手游| 永兴县| 广州市| 金沙县| 高清| 庄浪县| 余干县| 北宁市| 吴江市| 新源县| 泸定县| 涟源市| 喜德县| 海南省| 镇康县| 老河口市| 乾安县| 固镇县| 保康县| 南投县| 木兰县| 娱乐| 富阳市| 兴化市| 高青县| 兴宁市| 夏河县| 庐江县| 新闻| 南木林县| 德昌县| 科尔| 东丽区| 阜阳市|