NVIDIA-Merlin / core

Core Utilities for NVIDIA Merlin
Apache License 2.0
19 stars 14 forks source link

Enable Schema selection using `select_by_tag` with string representation of `Tags` enum. #242

Closed oliverholworthy closed 1 year ago

oliverholworthy commented 1 year ago

Enable Schema selection using select_by_tag with string representation of Tags enum.

Example

from merlin.schema import ColumnSchema, Schema, Tags

# before
Schema([ColumnSchema("a", tags=[Tags.CATEGORICAL])]).select_by_tag("categorical")
# =>
[]

# with this PR
Schema([ColumnSchema("a", tags=[Tags.CATEGORICAL])]).select_by_tag("categorical")
# =>
[{'name': 'a', 'tags': {<Tags.CATEGORICAL: 'categorical'>}, 'properties': {}, 'dtype': DType(name='unknown', element_type=<ElementType.Unknown: 'unknown'>, element_size=None, element_unit=None, signed=None, shape=Shape(dims=None)), 'is_list': False, 'is_ragged': False}]