woodwork.type_sys.type_system.TypeSystem

class woodwork.type_sys.type_system.TypeSystem(inference_functions=None, relationships=None, default_type=Unknown)[source]
__init__(inference_functions=None, relationships=None, default_type=Unknown)[source]

Create a new TypeSystem object. LogicalTypes that are present in the keys of the inference_functions dictionary will be considered registered LogicalTypes.

Parameters
  • inference_functions (dict[LogicalType->func], optional) – Dictionary mapping LogicalTypes to their corresponding type inference functions. If None, only the default LogicalType will be registered without an inference function.

  • relationships (list, optional) – List of tuples, each with two elements, specifying parent-child relationships between logical types. The first element should be the parent LogicalType. The second element should be the child LogicalType. If not specified, will default to an empty list indicating all types should be considered root types with no children.

  • default_type (LogicalType, optional) – The default LogicalType to use if no inference matches are found. If not specified, will default to the built-in Unknown LogicalType.

Methods

__init__([inference_functions, ...])

Create a new TypeSystem object.

add_type(logical_type[, inference_function, ...])

Add a new LogicalType to the TypeSystem, optionally specifying the corresponding inference function and a parent type.

infer_logical_type(series)

Infer the logical type for the given series

remove_type(logical_type)

Remove a logical type from the TypeSystem.

reset_defaults()

Reset type system to the default settings that were specified at initialization.

str_to_logical_type(logical_str[, params, ...])

Helper function for converting a string value to the corresponding logical type object.

update_inference_function(logical_type, ...)

Update the inference function for the specified LogicalType.

update_relationship(logical_type, parent)

Add or update a relationship.

Attributes

registered_types

Returns a list of all registered types

root_types

Returns a list of all registered types that do not have a parent type