本文简要介绍 python 语言中 numpy.ceil
的用法。
用法:
numpy.ceil(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True [, signature, extobj ]) = <ufunc 'ceil'>
按元素返回输入的上限。
标量的 ceilx是最小的整数i, 这样
i >= x
.它通常表示为 .- x: array_like
输入数据。
- out: ndarray,None,或 ndarray 和 None 的元组,可选
存储结果的位置。如果提供,它必须具有输入广播到的形状。如果未提供或 None,则返回一个新分配的数组。元组(只能作为关键字参数)的长度必须等于输出的数量。
- where: 数组,可选
此条件通过输入广播。在条件为真的位置,out数组将设置为 ufunc 结果。在其他地方,out数组将保留其原始值。请注意,如果未初始化out数组是通过默认创建的
out=None
,其中条件为 False 的位置将保持未初始化状态。- **kwargs:
对于其他仅关键字参数,请参阅 ufunc 文档。
- y: ndarray 或标量
每个元素的天花板x, 和
float
类型。这是一个标量,如果x是一个标量。
参数:
返回:
例子:
>>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) >>> np.ceil(a) array([-1., -1., -0., 1., 2., 2., 2.])
相关用法
- Python numpy chararray.ndim用法及代码示例
- Python numpy chebyshev.chebsub用法及代码示例
- Python numpy chararray.nbytes用法及代码示例
- Python numpy chebyshev.chebdiv用法及代码示例
- Python numpy copy用法及代码示例
- Python numpy chararray.setflags用法及代码示例
- Python numpy chararray.flat用法及代码示例
- Python numpy can_cast用法及代码示例
- Python numpy chararray.strides用法及代码示例
- Python numpy chebyshev.cheb2poly用法及代码示例
- Python numpy chararray.view用法及代码示例
- Python numpy chebyshev.chebx用法及代码示例
- Python numpy chebyshev.chebmul用法及代码示例
- Python numpy char.strip用法及代码示例
- Python numpy c_用法及代码示例
- Python numpy cross用法及代码示例
- Python numpy chebyshev.chebroots用法及代码示例
- Python numpy copysign用法及代码示例
- Python numpy char.upper用法及代码示例
- Python numpy chararray.imag用法及代码示例
- Python numpy chararray.base用法及代码示例
- Python numpy chararray.flatten用法及代码示例
- Python numpy chararray.copy用法及代码示例
- Python numpy clip用法及代码示例
- Python numpy char.count用法及代码示例
注:本文由纯净天空筛选整理自numpy.org大神的英文原创作品 numpy.ceil。非经特殊声明,原始代码版权归原作者所有,本译文未经允许或授权,请勿转载或复制。