numpy.zeros(shape, dtype=float, order='C')
2024-09-17 18:37:29
numpy.zeros
-
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 dtype
array([(0, 0), (0, 0)],
dtype=[('x', '<i4'), ('y', '<i4')])
最新文章
- ASP.NET MVC之如何看待内置配置来提高性能优化(四)
- 列间距column-gap
- .htaccess根据IP地址限制访问
- CentOS的安装与克隆
- Unity-Animator深入系列---控制IK
- Duilib中系统消息在自己窗口类的使用
- tomcat 多开设置 需要需改的3个端口
- 知问前端——概述及jQuery UI
- ios7高级
- win7下go web之revel
- thinking in java 随笔
- Spring(二):Spring框架&;Hello Spring
- 四、Tensorflow的分布式训练
- audio元素和video元素在ios和andriod中无法自动播放
- 9. Web browser-related (网页浏览器相关 4个)
- java PDF添加图层,支持多页图层添加
- 浅谈MemCahe
- web前端学习路线(含20个真实web开发项目集合)
- Angularjs集成第三方js插件之Uploadify
- POJ 1946 Cow Cycling(抽象背包, 多阶段DP)
热门文章
- Linux基础系列:常用命令(6)_nfs服务与nginx服务
- AbstractQueuedSynchronizer(一)
- Unity Json解析IPA
- POJ 之2386 Lake Counting
- Spark- SparkStreaming可更新状态的实例
- 深度学习—BN的理解(二)
- C++(四)— 字符串、数字翻转3种方法
- Mybatis_学习_00_资源帖
- Eclipse_常用技巧_03_字母大小写转换快捷键
- alt+shift+j 自动添加类的文档注释 Myeclipse