Skip to main content
Version: 1.7.1

tabsdata.tableframe.functions.col

ColThis class is used to create TableFrame column expressions.
ColumnRepresents a single column definition in a :class:TableFrame.
SysCol

Col

class Col(*args, **kwargs)

This class is used to create TableFrame column expressions.

An instance of this class is available as col. It can be called like a function (e.g., td.col("name")). For more information, refer to the __call__ method documentation.

This helper class provides an alternative way to create column expressions using attribute lookup. For instance, col.name is equivalent to col("name"). Refer to :func:__getattr__ method.

Example:

>>> import tabsdata as td
>>>
>>> tf: td.TableFrame ...
>>>
>>> tf = tf.with_columns(full_name=(td.col("last_name") + ", " + >>> td.col("first_name"))

Column

class Column(name: str | None = None, dtype: td_DataType = String)

Represents a single column definition in a :class:TableFrame.

A Column defines both the name and the data type of a column, along with other relevant metadata in the future. This abstraction provides a consistent way to declare and validate schema definitions for TableFrame objects.

Attributes:

attribute
namestr | None

The name of the column, or None if no name was provided.

attribute
dtypetd_DataType

The declared data type of the column.

Example:

Create a column with a name and type:

>>> import tabsdata as td
>>> Column("customer_id", td.Int64)
<Column name='customer_id' dtype=Int64>

Use columns to define a TableFrame schema:

>>> import tabsdata as td
>>> schema = [
... Column("customer_id", td.Int64),
... Column("signup_date", td.Datetime),
... ]
>>> for column in schema:
... print(column.name, column.dtype)
customer_id Int64
signup_date Datetime

SysCol

class SysCol(*args, **kwds)

Bases: StrEnum