ray.data.expressions.UnaryExpr#

class ray.data.expressions.UnaryExpr(op: Operation, operand: Expr)[source]#

Bases: Expr

Expression that represents a unary operation on a single expression.

This expression type represents an operation with one operand. Common unary operations include logical NOT, IS NULL, IS NOT NULL, etc.

Parameters:
  • op – The operation to perform (from Operation enum)

  • operand – The operand expression

Example

>>> from ray.data.expressions import col
>>> # Check if a column is null
>>> expr = col("age").is_null()  # Creates UnaryExpr(IS_NULL, col("age"))
>>> # Logical not
>>> expr = ~(col("active"))  # Creates UnaryExpr(NOT, col("active"))

DeveloperAPI: This API may change across minor Ray releases.

Methods

alias

Rename the expression.

is_in

Check if the expression value is in a list of values.

is_not_null

Check if the expression value is not null.

is_null

Check if the expression value is null.

not_in

Check if the expression value is not in a list of values.

to_pyarrow

Convert this Ray Data expression to a PyArrow compute expression.

Attributes

list

Access list operations for this expression.

name

Get the name associated with this expression.

str

Access string operations for this expression.

struct

Access struct operations for this expression.

op

operand

data_type