Skip to main content

class  pixeltable.exprs.Expr

A Pixeltable expression. All Pixeltable expressions, including column references (such as t.col), UDF calls (t.my_string.lower()), and compound expressions (t.col + 5) are instances of this class.

method  astype()

Signature
astype(new_type: ts.ColumnType | type | _AnnotatedAlias) -> exprs.TypeCast
Return a new expression that casts this expression to a different type. This represents a type cast, not a type coercion, so it will not mutate the underlying data; it simply changes the static type given by the expression. Parameters:
  • new_type (ts.ColumnType | type | _AnnotatedAlias): The type to cast to.
Examples: Given an existing column t.json_col of type pxt.Json, cast that column to type pxt.String:
t.json_col.astype(pxt.String)

method  isin()

Signature
isin(value_set: Any) -> exprs.InPredicate
Return a new, boolean-valued expression that is True whenever this expression is in value_set. Parameters:
  • value_set (Any): Either another expression that evaluates to a set of values, or a constant collection of values. If the latter, can be any Iterable.
Examples: These examples assume that t is a table with a column int_col of type pxt.Int, and another column list_col of type pxt.Json, containing lists of integers. Select all rows where int_col is in the constant set {1, 3, 22}:
t.where(t.int_col.isin({1, 3, 22})).select()
Select all rows where int_col is in the set of values in that row’s list_col:
t.where(t.int_col.isin(t.list_col)).select()
Last modified on April 11, 2026