woodwork.schema.Schema

class woodwork.schema.Schema(column_names, logical_types, name=None, index=None, time_index=None, semantic_tags=None, table_metadata=None, column_metadata=None, use_standard_tags=True, column_descriptions=None)[source]
__init__(column_names, logical_types, name=None, index=None, time_index=None, semantic_tags=None, table_metadata=None, column_metadata=None, use_standard_tags=True, column_descriptions=None)[source]

Create Schema

Parameters
  • column_names (list, set) – The columns present in the Schema.

  • logical_types (dict[str -> LogicalType]) – Dictionary mapping column names in the Schema to the LogicalType for the column. All columns present in the Schema must be present in the logical_types dictionary.

  • name (str, optional) – Name used to identify the Schema.

  • index (str, optional) – Name of the index column.

  • time_index (str, optional) – Name of the time index column.

  • semantic_tags (dict, optional) – Dictionary mapping column names in the Schema to the semantic tags for the column. The keys in the dictionary should be strings that correspond to columns in the Schema. There are two options for specifying the dictionary values: (str): If only one semantic tag is being set, a single string can be used as a value. (list[str] or set[str]): If multiple tags are being set, a list or set of strings can be used as the value. Semantic tags will be set to an empty set for any column not included in the dictionary.

  • table_metadata (dict[str -> json serializable], optional) – Dictionary containing extra metadata for the Schema.

  • column_metadata (dict[str -> dict[str -> json serializable]], optional) – Dictionary mapping column names to that column’s metadata dictionary.

  • use_standard_tags (bool, optional) – If True, will add standard semantic tags to columns based specified logical type for the column. Defaults to True.

  • column_descriptions (dict[str -> str], optional) – Dictionary mapping column names to column descriptions.

Methods

__init__(column_names, logical_types[, …])

Create Schema

add_semantic_tags(semantic_tags)

Adds specified semantic tags to columns, updating the Woodwork typing information.

remove_semantic_tags(semantic_tags)

Remove the semantic tags for any column names in the provided semantic_tags dictionary, updating the Woodwork typing information.

rename(columns)

Renames columns in a Schema

reset_semantic_tags([columns, retain_index_tags])

Reset the semantic tags for the specified columns to the default values.

set_index(new_index)

Sets the index.

set_time_index(new_time_index)

Set the time index.

set_types([logical_types, semantic_tags, …])

Update the logical type and semantic tags for any columns names in the provided types dictionaries, updating the Schema at those columns.

Attributes

index

The index column for the table

logical_types

A dictionary containing logical types for each column

semantic_tags

A dictionary containing semantic tags for each column

time_index

The time index column for the table

types

DataFrame containing the physical dtypes, logical types and semantic tags for the Schema.