Validate
Apply validation function(s) to schema cls_field.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cls_field
|
Attribute
|
Schema for field in class. |
required |
data
|
DataFrame
|
Data to validate field against. |
required |
Returns:
Type | Description |
---|---|
TidyError
|
If the validation function fails for at least one row, an error handler is returned for further logging. |
Source code in src/tidy_tools/model/validate.py
Validators
Tidy Tools comes with its own custom validators.
validate_nulls
Return expression checking for null values in column.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
_defaults
|
tuple[str]
|
Default values representing null. By default, checks for whitespace values and "N/A". |
('\\s*', '\\bN/A\\b')
|
Returns:
Type | Description |
---|---|
Callable
|
Constructs closure that can be called on column(s). |
Source code in src/tidy_tools/model/validators.py
validate_pattern
Return expression checking for pattern in column.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
pattern
|
str
|
Regular expression to check for in column. |
required |
Returns:
Type | Description |
---|---|
Callable
|
Constructs closure that can be called on column(s). |
Source code in src/tidy_tools/model/validators.py
validate_membership
Return expression checking for membership in column.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
elements
|
Sequence
|
Collection containing value(s) to check for in column. |
required |
Returns:
Type | Description |
---|---|
Callable
|
Constructs closure that can be called on column(s). |
Source code in src/tidy_tools/model/validators.py
validate_range
Return expression checking for inclusion in column.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lower_bound
|
Any
|
Least value to check for in column. |
required |
upper_bound
|
Any
|
Greatest value to check for in column. |
required |
Returns:
Type | Description |
---|---|
Callable
|
Constructs closure that can be called on column(s). |