Skip to main content
Pixeltable UDFs for mathematical operations. Example:
import pixeltable as pxt

t = pxt.get_table(...)
t.select(t.float_col.floor()).collect()
View source on GitHub

UDFs


abs() udf

Return the absolute value of the given number. Equivalent to Python builtins.abs(). Signature:
abs(self: Float)-> Float

bitwise_and() udf

Bitwise AND of two integers. Equivalent to Python self & other. Signature:
bitwise_and(
    self: Int,
    other: Int
)-> Int

bitwise_or() udf

Bitwise OR of two integers. Equivalent to Python self | other. Signature:
bitwise_or(
    self: Int,
    other: Int
)-> Int

bitwise_xor() udf

Bitwise XOR of two integers. Equivalent to Python self ^ other. Signature:
bitwise_xor(
    self: Int,
    other: Int
)-> Int

ceil() udf

Return the ceiling of the given number. Equivalent to Python float(math.ceil(self)) if self is finite, or self itself if self is infinite. (This is slightly different from the default behavior of math.ceil(self), which always returns an int and raises an error if self is infinite. The behavior in Pixeltable generalizes the Python operator and is chosen to align with the SQL standard.) Signature:
ceil(self: Float)-> Float

floor() udf

Return the ceiling of the given number. Equivalent to Python float(math.floor(self)) if self is finite, or self itself if self is infinite. (This is slightly different from the default behavior of math.floor(self), which always returns an int and raises an error if self is infinite. The behavior of Pixeltable generalizes the Python operator and is chosen to align with the SQL standard.) Signature:
floor(self: Float)-> Float

pow() udf

Raise self to the power of other. Equivalent to Python self ** other. Signature:
pow(
    self: Int,
    other: Int
)-> Float

round() udf

Round a number to a given precision in decimal digits. Equivalent to Python builtins.round(self, digits or 0). Note that if digits is not specified, the behavior matches builtins.round(self, 0) rather than builtins.round(self); this ensures that the return type is always float (as in SQL) rather than int. Signature:
round(
    self: Float,
    digits: Optional[Int]
)-> Float
I