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


相关推荐

  • SpringBoot跨域设置(CORS)「建议收藏」

    SpringBoot跨域设置(CORS)「建议收藏」目录什么是跨域跨域资源共享(CORS)1.简单请求2.非简单请求SpringBoot设置CORS1.配置过滤器CorsFilter2.实现接口WebMvcConfigurer3.使用注解@CrossOrigin什么是跨域请求url的协议、域名、端口三者有任意一个不同即为跨域。跨域问题是因为浏览器的同源策略的限制而产生的。同源:请求url的协议、域名、端口三者都相同即为同源(同一个域)。同源策略:同源策略(Sameoriginpolicy)是一种约定,他是浏览器最核心也最基本的安全

    2022年6月18日
    23
  • 数组和链表的区别和优缺点总结!

    数组和链表的区别和优缺点总结!数组和链表是两种基本的数据结构,他们在内存存储上的表现不一样,所以也有各自的特点。链表中各结点在内存中的存放位置是任意的。 链表与数组的主要区别(1)数组的元素个数是固定的,而组成链表的结点个数可按需要增减;(2)数组元素的存诸单元在数组定义时分配,链表结点的存储单元在程序执行时动态向系统申请:(3)数组中的元素顺序关系由元素在数组中的位置(即下标)确定,链表中的结点顺序关系…

    2022年6月16日
    23
  • ubuntu find方法

    ubuntu find方法

    2021年5月14日
    119
  • js将字符串时间转换为date对象_js转换日期格式

    js将字符串时间转换为date对象_js转换日期格式vars=’2018-10-0910:23:12′;s=s.replace(/-/g,"/");vardate=newDate(s);

    2022年10月3日
    0
  • JAVA高并发的三种实现

    提到锁,大家肯定想到的是sychronized关键字。是用它可以解决一切并发问题,但是,对于系统吞吐量要求更高的话,我们这提供几个小技巧。帮助大家减小锁颗粒度,提高并发能力。初级技巧-乐观锁乐观锁使用的场景是,读不会冲突,写会冲突。同时读的频率远大于写。悲观锁的实现:悲观的认为所有代码执行都会有并发问题,所以将所有代码块都用sychronized锁住乐观锁的实现:…

    2022年4月3日
    32
  • pycharm创建python虚拟环境好处_pycharm创建虚拟环境很慢

    pycharm创建python虚拟环境好处_pycharm创建虚拟环境很慢很多时候由于每个项目所需要的库和其版本都不一样,在根目录下运行项目的复杂性会大很多,这是很多人会选择使用虚拟环境,今天给大家介绍一些pycharm中傻瓜式添加虚拟环境的方法。pycharm首页:File=>Settings=>你的项目名下的pythoninterpreter=>设置按钮=>addpythoninterpreter图1在该页面下的VirtualenvEnvironment(虚拟环境设置界面),有两种设置添加虚拟环境的选项。Ne

    2022年8月26日
    10

发表回复

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

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