python中向下取整(round向下取整)

fromnumpy\core_multiarray_umath.pynp.floor()deffloor(x,*args,**kwargs):#realsignatureunknown;NOTE:unreliablyrestoredfrom__doc__”””floor(x,/,out=None,*,where=True,casting=’same_kind’,order=’K’,dtype=None,subok=True[,signat

大家好,又见面了,我是你们的朋友全栈君。

from numpy\core_multiarray_umath.py

np.floor()

def floor(x, *args, **kwargs): # real signature unknown; NOTE: unreliably restored from __doc__ 
    """ floor(x, /, out=None, *, where=True, casting='same_kind', order='K', dtype=None, subok=True[, signature, extobj]) Return the floor of the input, element-wise. 以元素为单位返回输入的下限。 The floor of the scalar `x` is the largest integer `i`, such that `i <= x`. It is often denoted as :math:`\lfloor x \rfloor`. 标量“ x”的下限是最大的整数“ i”,因此“ i <= x”。 它通常表示为:\ lfloor x \ rfloor`。 Parameters ---------- x : array_like Input data. out : ndarray, None, or tuple of ndarray and None, optional A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned. A tuple (possible only as a keyword argument) must have length equal to the number of outputs. 结果存储的位置。 如果提供,它必须具有输入广播到的形状。 如果未提供或没有,则返回一个新分配的数组。 元组(只能作为关键字参数)的长度必须等于输出的数量。 where : array_like, optional This condition is broadcast over the input. At locations where the condition is True, the `out` array will be set to the ufunc result. Elsewhere, the `out` array will retain its original value. Note that if an uninitialized `out` array is created via the default ``out=None``, locations within it where the condition is False will remain uninitialized. 此条件通过输入广播。 在条件为True的位置,将`out`数组设置为ufunc结果。 在其他地方,`out`数组将保留其原始值。 请注意,如果通过默认的“ out = None”创建了未初始化的“ out”数组, 则条件为False的数组中的位置将保持未初始化状态。 **kwargs For other keyword-only arguments, see the :ref:`ufunc docs <ufuncs.kwargs>`. Returns ------- y : ndarray or scalar The floor of each element in `x`. This is a scalar if `x` is a scalar. x中每个元素的下限。 如果x是标量,则这是标量。 See Also -------- ceil, trunc, rint Notes ----- Some spreadsheet programs calculate the "floor-towards-zero", in other words ``floor(-2.5) == -2``. NumPy instead uses the definition of `floor` where `floor(-2.5) == -3`. 某些电子表格程序会计算“底数朝零”,而其他单词``floor(-2.5)== -2''。 NumPy改为使用`floor`其中`floor(-2.5)== -3` Examples -------- >>> a = np.array([-1.7, -1.5, -0.2, 0.2, 1.5, 1.7, 2.0]) >>> np.floor(a) array([-2., -2., -1., 0., 1., 1., 2.]) """
    pass

np.ceil()同理

示例

# -*- coding: utf-8 -*-
""" @File : test.py @Time : 2020/6/25 11:27 @Author : Dontla @Email : sxana@qq.com @Software: PyCharm """
import numpy as np

print(np.ceil(1.7)) # 2.0

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/127780.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • a4纸两版的小册子怎么打印_word怎么打印小册子用a4

    a4纸两版的小册子怎么打印_word怎么打印小册子用a4用word打印小册子具体操作步骤:1、首先打开将要打印的文档,然后在菜单栏下面的快捷菜单栏,找到打印机的快捷图标,单击鼠标左键选择打开打印机。2、会弹出打印机设置对话框,可以进行打印前的一些细节的设置,由于是要选择打印一本小册子所以选择打印“所有页面”。3、在下面一栏是调整页面大小,也就是打印模式,选择“小册子”进行打印。4、然后下面是关于小册子的一些设置,按照自己的需要进行设置。5、设置完成以后…

    2025年9月22日
    9
  • MySQL常用SQL语句大全

    MySQL常用SQL语句大全MySQL数据库是一个十分轻便的数据库管理系统,相比大型的数据库管理系统如Oracle、MS-SQL,MySQL更拥有轻便、灵活、开发速度快的特色,更适用于中小型数据的存储与架构。MySQL之所以能够被数以万计的网站采用,也是由此而来。

    2022年6月13日
    27
  • 精进Spring—Spring常用注解【经典总结】

    Spring的一个核心功能是IOC,就是将Bean初始化加载到容器中,Bean是如何加载到容器的,可以使用Spring注解方式或者Spring XML配置方式。 Spring注解方式减少了配置文件内容,更加便于管理,并且使用注解可以大大提高了开发效率!

    2022年2月26日
    50
  • MySQL八股文连环45问,你能坚持第几问?「建议收藏」

    MySQL八股文连环45问,你能坚持第几问?「建议收藏」文人从事多年面试工作,将MySQL面试分享给大家,希望大家顺利拿下offer

    2022年5月18日
    42
  • Lucene教程具体解释

    Lucene教程具体解释

    2021年12月10日
    62
  • html空格代码_html中空格怎么表示

    html空格代码_html中空格怎么表示html中空格代码的写法一:&nbsp(不换行空格)html中空格代码的写法二:&ensp(半角空格)html中空格代码的写法三:&emsp(全角空格)html中空格代码的写法四:&thinsp(窄空格)html中空格代码的写法五:&zwnj(零宽不连字)说明:&zwnj是一个不打印字符,放在电子文本的两个字符之间,抑制本来会发生的连字,而是以这两个字符原本的字形来绘制。html中空格代码的写法六:&zwj(零宽连字)说明:&amp

    2022年9月22日
    4

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号