col
def col(
name: str | PolarsDataType | PythonDataType | Iterable[str] | Iterable[PolarsDataType | PythonDataType],
*more_names: str | PolarsDataType | PythonDataType = (),
) -> Expr
Categories: projection
Reference one or more columns as an expression.
The returned Expr is the building block passed to select,
with_columns, filter and agg.
Parameters
parameter
namestr | PolarsDataType | PythonDataType | Iterable[str] | Iterable[PolarsDataType | PythonDataType] (str | DataType | type[int] | type[float] | type[bool] | type[str] | type[date] | type[time] | type[datetime] | type[timedelta] | type[list[Any]] | type[tuple[Any, ...]] | type[bytes] | type[object] | type[Decimal] | type[None] | Iterable[str] | Iterable[DataType | type[int] | type[float] | type[bool] | type[str] | type[date] | type[time] | type[datetime] | type[timedelta] | type[list[Any]] | type[tuple[Any, ...]] | type[bytes] | type[object] | type[Decimal] | type[None]])A column name, a data type (to select every column of that
type), or an iterable of either. A name wrapped in ^ and
$ is treated as a regular expression.
parameter
*more_namesstr | PolarsDataType | PythonDataType (str | DataType | type[int] | type[float] | type[bool] | type[str] | type[date] | type[time] | type[datetime] | type[timedelta] | type[list[Any]] | type[tuple[Any, ...]] | type[bytes] | type[object] | type[Decimal] | type[None])Additional column names or data types, as positional arguments.
Examples
tf.select(col("a"), (col("b") * 2).alias("b2"))
tf.filter(col("g").is_in(["x", "y"]))