Expressions¶
Vortex expressions represent simple filtering conditions on the rows of a Vortex array. For example, the following expression represents the set of rows for which the age column lies between 23 and 55:
>>> import vortex.expr
>>> age = vortex.expr.column("age")
>>> (23 > age) & (age < 55)
Create an expression that refers to a column by its name. |
|
An expression describes how to filter rows when reading an array from a file. |
- vortex.expr.column(name)¶
Create an expression that refers to a column by its name.
- Parameters:
name (
str
) – The name of the column.- Return type:
Examples
>>> import vortex.expr as ve >>> ve.column("age") <vortex.Expr object at ...>
- vortex.expr.not_(child)¶
Negate a Boolean expression.
- Parameters:
child (
Any
) – A boolean expression.- Return type:
Examples
>>> import vortex.expr as ve >>> import vortex as vx >>> ve.not_(ve.literal(vx.int_(), 42) == ve.literal(vx.int_(), 42)) <vortex.Expr object at ...>
- vortex.expr.and_(left, right)¶
True if both arguments are true.
- Parameters:
child (
Any
) – A boolean expression.- Return type:
Examples
>>> import vortex.expr as ve >>> import vortex as vx >>> ve.and_(ve.literal(vx.bool_(), True), ve.literal(vx.bool_(), True)) <vortex.Expr object at ...>
- vortex.expr.root()¶
Create an expression that refers to the identity scope.
That is, it returns the full input that the extension is run against.
- Return type:
Examples
>>> import vortex.expr as ve >>> ve.root() <vortex.Expr object at ...>
- vortex.expr.literal(dtype, value)¶
Create an expression that represents a literal value.
- Parameters:
dtype (
vortex.DType
) – The data type of the literal value.value (
Any
) – The literal value.
- Return type:
Examples
>>> import vortex.expr as ve >>> ve.literal(vx.int_(), 42) <vortex.Expr object at ...>