HasLength
class HasLength(
column_names: str | tuple[str, str | None] | Annotated[list[str], <class 'Strict'>] | Annotated[list[tuple[str, str | None]], <class 'Strict'>] | NoneType = None,
min_len: Annotated[int, Strict(strict=True), FieldInfo(annotation=NoneType, required=True, metadata=[Ge(ge=0)])] = 0,
max_len: Annotated[int, Strict(strict=True), FieldInfo(annotation=NoneType, required=True, metadata=[Ge(ge=0)])] = 9223372036854775807,
on_missing_column: Literal['ignore', 'fail'] = 'ignore',
on_wrong_type: Literal['ignore', 'fail'] = 'ignore',
tags: str | list[str] | NoneType = None,
)
Bases: BoolClassifier
Categories: dq-classifier
A boolean classifier that checks if the length of a value is within a given range.
Initializes the HasLength classifier.
Parameters
column_namesThe column(s) to check.
min_lenThe minimum allowed length (inclusive).
max_lenThe maximum allowed length (inclusive).
on_missing_columnWhat to do if a column name is missing.
on_wrong_typeBehavior when a column’s type is incompatible with the classifier.
tagsOptional tags for the classifier.
Properties
column_nameslist[tuple[str, str | None]] | NoneReturns the list of columns the classifier applies to, including optional destination column names.
maxintReturns the maximum allowed length.
minintReturns the minimum allowed length.
on_missing_columnLiteral['ignore', 'fail']Returns what do if the column is missing.
on_wrong_typeLiteral['ignore', 'fail']Returns what do if the column type is incompatible with the classifier.
on_wrong_valueLiteral['ignore', 'fail']Returns what do if the column type is incompatible with the classifier.
tagslist[str] | NoneReturns the list of tags associated with the classifier.
Methods
supported_dtypesdef supported_dtypes() -> FrozenSet[Type]
Returns the set of data types supported by HasLength classifier.