Skip to content

Math

abs

abs(col: T) -> T

Returns the absolute value of col.

Wrapper for pyspark.sql.functions.abs.

acos

acos(col: Numeric) -> Double

Returns the inverse cosine of col in radians.

Wrapper for pyspark.sql.functions.acos.

acosh

acosh(col: Numeric) -> Double

Returns the inverse hyperbolic cosine of col.

Wrapper for pyspark.sql.functions.acosh.

add_months

add_months(start: Date, months: Integer | int) -> Date

Returns the date that is months months after start.

Wrapper for pyspark.sql.functions.add_months.

asin

asin(col: Numeric) -> Double

Returns the inverse sine of col in radians.

Wrapper for pyspark.sql.functions.asin.

asinh

asinh(col: Numeric) -> Double

Returns the inverse hyperbolic sine of col.

Wrapper for pyspark.sql.functions.asinh.

atan

atan(col: Numeric) -> Double

Returns the inverse tangent of col in radians.

Wrapper for pyspark.sql.functions.atan.

atan2

atan2(col1: Numeric, col2: Numeric) -> Double

Returns the angle in radians between the positive x-axis and the point (col2, col1).

Wrapper for pyspark.sql.functions.atan2.

atanh

atanh(col: Numeric) -> Double

Returns the inverse hyperbolic tangent of col.

Wrapper for pyspark.sql.functions.atanh.

bround

bround(col: Numeric, scale: int = 0) -> Double

Returns col rounded to scale decimal places using banker's rounding (round half to even).

Wrapper for pyspark.sql.functions.bround.

cbrt

cbrt(col: Numeric) -> Double

Returns the cube root of col.

Wrapper for pyspark.sql.functions.cbrt.

ceil

ceil(
    col: Decimal, scale: Int | int | None = None
) -> Decimal
ceil(
    col: Int | Long | Float | Double, scale: None = None
) -> Long
ceil(col: Numeric, scale: Int | int) -> Decimal
ceil(
    col: Numeric, scale: Int | int | None = None
) -> Long | Decimal

Returns the smallest integer not less than col. With scale, rounds up to that many decimal places.

Returns Long, or Decimal when col is a Decimal or scale is given.

Wrapper for pyspark.sql.functions.ceil.

cos

cos(col: Numeric) -> Double

Returns the cosine of col (angle in radians).

Wrapper for pyspark.sql.functions.cos.

cosh

cosh(col: Numeric) -> Double

Returns the hyperbolic cosine of col.

Wrapper for pyspark.sql.functions.cosh.

cot

cot(col: Numeric) -> Double

Returns the cotangent of col (angle in radians).

Wrapper for pyspark.sql.functions.cot.

csc

csc(col: Numeric) -> Double

Returns the cosecant of col (angle in radians).

Wrapper for pyspark.sql.functions.csc.

degrees

degrees(col: Numeric) -> Double

Converts col from radians to degrees.

Wrapper for pyspark.sql.functions.degrees.

e

e() -> Double

Returns Euler's number (e ≈ 2.718).

Wrapper for pyspark.sql.functions.e.

exp

exp(col: Numeric) -> Double

Returns e raised to the power of col.

Wrapper for pyspark.sql.functions.exp.

expm1

expm1(col: Numeric) -> Double

Returns e raised to the power of col minus 1 (more accurate than exp(col) - 1 near zero).

Wrapper for pyspark.sql.functions.expm1.

factorial

factorial(col: Integer) -> Long

Returns the factorial of col.

Wrapper for pyspark.sql.functions.factorial.

floor

floor(
    col: Decimal, scale: Int | int | None = None
) -> Decimal
floor(
    col: Int | Long | Float | Double, scale: None = None
) -> Long
floor(col: Numeric, scale: Int | int) -> Decimal
floor(
    col: Numeric, scale: Int | int | None = None
) -> Long | Decimal

Returns the largest integer not greater than col. With scale, rounds down to that many decimal places.

Returns Long, or Decimal when col is a Decimal or scale is given.

Wrapper for pyspark.sql.functions.floor.

hypot

hypot(col1: Numeric, col2: Numeric) -> Double

Returns the hypotenuse of a right triangle with legs col1 and col2.

Wrapper for pyspark.sql.functions.hypot.

ln

ln(col: Numeric) -> Double

Returns the natural logarithm of col.

Wrapper for pyspark.sql.functions.ln.

log

log(col: Numeric, base: float | None = None) -> Double

Returns the logarithm of col. Uses natural log when base is omitted.

Wrapper for pyspark.sql.functions.log.

log10

log10(col: Numeric) -> Double

Returns the base-10 logarithm of col.

Wrapper for pyspark.sql.functions.log10.

log1p

log1p(col: Numeric) -> Double

Returns the natural logarithm of col + 1 (more accurate than log(col + 1) near zero).

Wrapper for pyspark.sql.functions.log1p.

log2

log2(col: Numeric) -> Double

Returns the base-2 logarithm of col.

Wrapper for pyspark.sql.functions.log2.

negate

negate(col: T) -> T

Returns the negation of col.

Wrapper for pyspark.sql.functions.negate.

pi

pi() -> Double

Returns the value of π (pi ≈ 3.14159).

Wrapper for pyspark.sql.functions.pi.

pmod

pmod(dividend: T, divisor: T) -> T

Returns the positive remainder of dividend divided by divisor.

Wrapper for pyspark.sql.functions.pmod.

positive

positive(col: T) -> T

Returns col unchanged (unary positive).

Wrapper for pyspark.sql.functions.positive.

pow

pow(col: Numeric, other: Numeric | float) -> Double

Returns col raised to the power of other.

Wrapper for pyspark.sql.functions.pow.

radians

radians(col: Numeric) -> Double

Converts col from degrees to radians.

Wrapper for pyspark.sql.functions.radians.

rand

rand(seed: int | None = None) -> Double

Returns a uniformly distributed random value in [0, 1).

Wrapper for pyspark.sql.functions.rand.

randn

randn(seed: int | None = None) -> Double

Returns a random value drawn from the standard normal distribution.

Wrapper for pyspark.sql.functions.randn.

rint

rint(col: Numeric) -> Double

Returns the double value closest to col that is equal to a mathematical integer.

Wrapper for pyspark.sql.functions.rint.

round

round(col: T, scale: int = 0) -> T

Returns col rounded to scale decimal places using HALF_UP rounding.

Wrapper for pyspark.sql.functions.round.

sec

sec(col: Numeric) -> Double

Returns the secant of col (angle in radians).

Wrapper for pyspark.sql.functions.sec.

sign

sign(col: T) -> T

Returns -1, 0, or 1 depending on the sign of col.

Wrapper for pyspark.sql.functions.sign.

sin

sin(col: Numeric) -> Double

Returns the sine of col (angle in radians).

Wrapper for pyspark.sql.functions.sin.

sinh

sinh(col: Numeric) -> Double

Returns the hyperbolic sine of col.

Wrapper for pyspark.sql.functions.sinh.

sqrt

sqrt(col: Numeric) -> Double

Returns the square root of col.

Wrapper for pyspark.sql.functions.sqrt.

tan

tan(col: Numeric) -> Double

Returns the tangent of col (angle in radians).

Wrapper for pyspark.sql.functions.tan.

tanh

tanh(col: Numeric) -> Double

Returns the hyperbolic tangent of col.

Wrapper for pyspark.sql.functions.tanh.

width_bucket

width_bucket(
    v: Numeric,
    min: Numeric,
    max: Numeric,
    numBucket: Integer | int,
) -> Long

Returns the bucket number for v partitioning [min, max] into numBucket equal-width buckets.

Wrapper for pyspark.sql.functions.width_bucket.