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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • 软件定义网络(SDN)基础概念学习笔记(下)

    软件定义网络(SDN)基础概念学习笔记(下)第四章1.南向接口协议设计目标/主要任务承上启下,分离控制平面与数据平面实现网络配置与管理实现路径计算,包括网络开销、链路状态等已实现的南向接口协议Openflow:Openflow交换机与控制器的信息交互OF-Config:Openflow交换机的配置和管理NETCONF:网络设备的配置与管理OVSDB:OpenvSwitch的配置与管理XMPP:用于即时通讯(O…

    2022年9月4日
  • Vue(8)列表渲染v-for[通俗易懂]

    Vue(8)列表渲染v-for[通俗易懂]循环在模板中可以用v-for指令来循环数组,对象等。循环数组我们可以用v-for指令基于一个数组来渲染一个列表。v-for指令需要使用iteminitems形式的特殊语法,其中it

    2022年7月31日
  • LDAP 中的 RDN「建议收藏」

    LDAP 中的 RDN「建议收藏」什么是RDN,RDN和DN又有什么关系呢?很多第一次接触到LDAP的童鞋,经常会被一堆名字搞得晕头转向。RDN(relativedistinguishedname)中文翻译就是相对专有名字。一般指dn逗号最左边的部分,如cn=baby。DN是由多个RDN组织而成的。CN=cwikius,ou=Users,dc=jumpcloud,dc=com上面的RDN就不是一个了,这个DN的RDN就有4个,分别是:CN=cwikius ou=Use

    2022年6月18日
  • mybatis的rowbounds_oracle使用rownum分页

    mybatis的rowbounds_oracle使用rownum分页物理分页和逻辑分页物理分页:直接从数据库中拿出我们需要的数据,例如在Mysql中使用limit。逻辑分页:从数据库中拿出所有符合要求的数据,然后再从这些数据中拿到我们需要的分页数据。优缺点物理分页每次都要访问数据库,逻辑分页只访问一次。物理分页占用内存少,逻辑分页相对较多。物理分页数据每次都是最新的,逻辑分页有可能滞后。在mybatis中,使用RowBounds进行分页,非常方便,不需要在sql语句中写limit,即可完成分页功能。但是由于它是在sql查询出所有结果的

    2022年9月2日
  • 晶晶图js小女孩行走动画

    晶晶图js小女孩行走动画1<!DOCTYPEhtml>2<htmllang=”en”>3<head>4<metacharset=”UTF-8″>5<title>Document</title>6<styletype=”text/css”>7…

    2022年7月17日
  • JSP_include指令和&lt;jsp:include&gt;

    JSP_include指令和&lt;jsp:include&gt;

    2022年1月6日

发表回复

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

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