Math(数学(Math))¶
from pyspark.sql import functions as F
Rounding¶
F.bround(x, scale=0)-
Round the given value of column x to scale decimal places using
HALF_EVENrounding mode ifscale >= 0or at integral part whenscale < 0. -
F.ceil(x) -
Computes the ceiling of the given value.
-
F.round(column, scale=0) -
F.floor(column)
Logarithms¶
F.log(arg1, arg2=None)F.log10(column)F.log1p(column)
Random¶
F.rand(seed=None)-
Independent and identically distributed (i.i.d.) samples from a uniform distribution [0.0, 1.0]
-
F.randn(seed=None) - Independent and identically distributed (i.i.d.) samples from the standard normal distribution
Trigonometry¶
F.cos(x)-
Computes the cosine of the numeric column x.
-
F.sin(x) -
F.tan(x) -
F.acos(x) -
Computes the cosine inverse of a numeric column x; the returned angle is in the range
[0.0, π]. cos-1(x) -
F.asin(x) -
Computes the sine inverse of a numeric column x; the returned angle is in the range
[-π/2, π/2]. sin-1(x) -
F.atan(x) -
Computes the tangent inverse of a numeric column x. tan-1(x)
-
F.atan2(x, y) -
Returns the angle theta from the conversion of rectangular coordinates
(x, y)represented by columns x, y to polar coordinates(r, theta). -
F.cosh(x) -
Computes the hyperbolic cosine of column x.
-
F.sinh(x) -
F.tanh(x)
Angles¶
F.degrees(column)F.radians(column)
Misc¶
F.abs(x)- Absolute value of
x F.cbrt(x)- Computes the cube-root of the given value.
F.exp(x)F.expm1(x)F.factorial(x)F.greatest(*cols)F.hypot(x, y)F.least(*cols)F.pow(x, y)xraised to the poweryF.rint(column)F.signum(column)F.sqrt(column)
中文翻译¶
数学(Math)¶
from pyspark.sql import functions as F
四舍五入(Rounding)¶
F.bround(x, scale=0)-
对列 x 的给定值进行四舍五入,当
scale >= 0时使用HALF_EVEN舍入模式保留指定小数位数,当scale < 0时对整数部分进行舍入。 -
F.ceil(x) -
计算给定值的向上取整结果。
-
F.round(column, scale=0) -
F.floor(column)
对数(Logarithms)¶
F.log(arg1, arg2=None)F.log10(column)F.log1p(column)
随机数(Random)¶
F.rand(seed=None)-
从均匀分布 [0.0, 1.0] 中生成独立同分布(i.i.d.)的样本
-
F.randn(seed=None) - 从标准正态分布中生成独立同分布(i.i.d.)的样本
三角函数(Trigonometry)¶
F.cos(x)-
计算数值列 x 的余弦值。
-
F.sin(x) -
F.tan(x) -
F.acos(x) -
计算数值列 x 的反余弦值;返回的角度范围在
[0.0, π]之间。 cos-1(x) -
F.asin(x) -
计算数值列 x 的反正弦值;返回的角度范围在
[-π/2, π/2]之间。 sin-1(x) -
F.atan(x) -
计算数值列 x 的反正切值。 tan-1(x)
-
F.atan2(x, y) -
将列 x、y 表示的直角坐标
(x, y)转换为极坐标(r, theta),返回角度 theta。 -
F.cosh(x) -
计算列 x 的双曲余弦值。
-
F.sinh(x) -
F.tanh(x)
角度(Angles)¶
F.degrees(column)F.radians(column)
其他函数(Misc)¶
F.abs(x)x的绝对值F.cbrt(x)- 计算给定值的立方根。
F.exp(x)F.expm1(x)F.factorial(x)F.greatest(*cols)F.hypot(x, y)F.least(*cols)F.pow(x, y)x的y次幂F.rint(column)F.signum(column)F.sqrt(column)