> ## Documentation Index
> Fetch the complete documentation index at: https://docs.pixeltable.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Expr

> <a href="https://github.com/pixeltable/pixeltable/blob/main/pixeltable/exprs/expr.py#L47" id="viewSource" target="_blank" rel="noopener noreferrer"><img src="https://img.shields.io/badge/View%20Source%20on%20Github-blue?logo=github&labelColor=gray" alt="View Source on GitHub" style={{ display: 'inline', margin: '0px' }} noZoom /></a>

# <span style={{ 'color': 'gray' }}>class</span>  pixeltable.exprs.Expr

A Pixeltable expression.

All Pixeltable expressions, including [column references](./columnref) (such as `t.col`),
UDF calls (`t.my_string.lower()`), and compound expressions (`t.col + 5`) are instances of this class.

Not thread-safe: Expr and subclasses contain execution state and are never thread-safe.

## <span style={{ 'color': 'gray' }}>method</span>  astype()

```python Signature theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
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`:

```python theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
t.json_col.astype(pxt.String)
```

This will assume that all values in `t.json_col` are *actually* strings, and it will result in an error
at runtime if there are values in `t.json_col` that are not strings. It will *not* convert those values to
a string representation. (For that, use the \[`dumps()`]\[pixeltable.functions.json.dumps] UDF instead.)

## <span style={{ 'color': 'gray' }}>method</span>  isin()

```python Signature theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
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}`:

```python theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
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`:

```python theme={"theme":{"light":"light-plus","dark":"dark-plus"}}
t.where(t.int_col.isin(t.list_col)).select()
```
