詹惠儿

2019-01-07   阅读量: 601

数据分析师

Python中的数学函数(1)

扫码加入数据分析学习群

在python中,可以通过导入名为“math”的模块轻松执行许多数学运算,该模块定义了使我们的任务更容易的各种函数。


1. ceil(): - 此函数返回大于数字最小整数值。如果number已经是整数,则返回相同的数字。
2. floor(): - 此函数返回小于数字最大整数值。如果number已经是整数,则返回相同的数字。

# Python code to demonstrate the working of

# ceil() and floor()

# importing "math" for mathematical operations

import math

a = 2.3

# returning the ceil of 2.3

print ("The ceil of 2.3 is : ", end="")

print (math.ceil(a))

# returning the floor of 2.3

print ("The floor of 2.3 is : ", end="")

print (math.floor(a))

添加CDA认证专家【维克多阿涛】,微信号:【cdashijiazhuang】,提供数据分析指导及CDA考试秘籍。已助千人通过CDA数字化人才认证。欢迎交流,共同成长!
0.0000 0 1 关注作者 收藏

评论(0)


暂无数据

推荐课程

推荐帖子