Utils
Utility functions for the pandas_checks package.
_display_line(line, lead_in=None, colors={})
Displays a line of text with optional formatting.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
line
|
str
|
The text to display. |
required |
lead_in
|
Union[str, None]
|
The optional text to display before the main text. |
None
|
colors
|
Dict
|
An optional dictionary containing color options for the text and lead-in text. See syntax in docstring for _render_text(). |
{}
|
Returns:
Type | Description |
---|---|
None
|
None |
_has_nulls(data, fail_message, raise_exception=True, exception_to_raise=DataError)
Utility function to check for nulls as part of a larger check
_is_type(data, dtype)
Utility function to check if a dataframe's columns or one series has an expected type. Includes special handling for strings, since 'object' type in Pandas may not mean a string
_lambda_to_string(lambda_func)
Create a string representation of a lambda function.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
lambda_func
|
Callable
|
An arbitrary function in lambda form |
required |
Returns:
Type | Description |
---|---|
str
|
A string version of lambda_func |
Todo
This still returns all arguments to the calling function. They get entangled with the argument when it's a lambda function. Try other ways to get just the argument we want.
_series_is_type(s, dtype)
Utility function to check if a series has an expected type. Includes special handling for strings, since 'object' type in Pandas may not mean a string