merlin.schema.ColumnSchema#

class merlin.schema.ColumnSchema(name: str, tags: ~merlin.schema.tags.TagSet | ~typing.List[str | ~merlin.schema.tags.Tags] | None = <factory>, properties: ~typing.Dict | None = <factory>, dtype: ~merlin.dtypes.base.DType | None = None, is_list: bool | None = None, is_ragged: bool | None = None, dims: dataclasses.InitVar[typing.Union[typing.Tuple, merlin.dtypes.shape.Shape]] = None)[source]#

Bases: object

A schema containing metadata of a dataframe column.

__init__(name: str, tags: ~merlin.schema.tags.TagSet | ~typing.List[str | ~merlin.schema.tags.Tags] | None = <factory>, properties: ~typing.Dict | None = <factory>, dtype: ~merlin.dtypes.base.DType | None = None, is_list: bool | None = None, is_ragged: bool | None = None, dims: dataclasses.InitVar[typing.Union[typing.Tuple, merlin.dtypes.shape.Shape]] = None) None#

Methods

__init__(name[, tags, properties, dtype, ...])

with_dtype(dtype[, is_list, is_ragged])

Create a copy of this ColumnSchema object with different column dtype

with_name(name)

Create a copy of this ColumnSchema object with a different column name

with_properties(properties)

Create a copy of this ColumnSchema object with different column properties

with_shape(shape)

Create a copy of this object with a new shape

with_tags(tags)

Create a copy of this ColumnSchema object with different column tags

Attributes

name: str#
tags: TagSet | List[str | Tags] | None#
properties: Dict | None#
dtype: DType | None = None#
is_list: bool | None = None#
is_ragged: bool | None = None#
dims: dataclasses.InitVar[Union[Tuple, merlin.dtypes.shape.Shape]] = None#
property shape#
with_name(name: str) ColumnSchema[source]#

Create a copy of this ColumnSchema object with a different column name

Parameters:

name (str) – New column name

Returns:

Copied object with new column name

Return type:

ColumnSchema

with_tags(tags: str | Tags) ColumnSchema[source]#

Create a copy of this ColumnSchema object with different column tags

Parameters:

tags (Union[str, Tags]) – New column tags

Returns:

Copied object with new column tags

Return type:

ColumnSchema

with_properties(properties: dict) ColumnSchema[source]#

Create a copy of this ColumnSchema object with different column properties

Parameters:

properties (dict) – New column properties

Returns:

Copied object with new column properties

Return type:

ColumnSchema

Raises:

TypeError – If properties are not a dict

with_dtype(dtype, is_list: bool | None = None, is_ragged: bool | None = None) ColumnSchema[source]#

Create a copy of this ColumnSchema object with different column dtype

Parameters:
  • dtype (np.dtype) – New column dtype

  • is_list (bool :) –

    Whether rows in this column contain lists.

    (Default value = None)

  • is_ragged (bool :) –

    Whether lists in this column have varying lengths.

    (Default value = None)

Returns:

Copied object with new column dtype

Return type:

ColumnSchema

with_shape(shape: Tuple | Shape) ColumnSchema[source]#

Create a copy of this object with a new shape

Parameters:

shape (Union[Tuple, Shape]) – Object to set as shape, must be either a tuple or Shape.

Returns:

A copy of this object containing the provided shape value

Return type:

ColumnSchema

Raises:

TypeError – If value is not either a tuple or a Shape

property int_domain: Domain | None#
property float_domain: Domain | None#
property value_count: Domain | None#