Run checks
Utilities for running Pandas Checks data checks.
_apply_modifications(data, fn=lambda df: df, subset=None)
Applies user's modifications to a data object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
Any
|
May be any Pandas DataFrame, Series, string, or other variable |
required |
fn
|
Callable
|
An optional lambda function to modify |
lambda df: df
|
subset
|
Union[str, List, None]
|
Columns to subset after applying modifications |
None
|
Returns:
Type | Description |
---|---|
Any
|
Modified and optionally subsetted data object. If all arguments are defaults, data is returned unchanged. |
_check_data(data, check_fn=lambda df: df, modify_fn=lambda df: df, subset=None, check_name=None)
Runs a selected check on a data object
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
Any
|
A Pandas DataFrame, Series, string, or other variable |
required |
check_fn
|
Callable
|
Function to apply to data for checking. For example if we're running .check.value_counts(), this function would appply the Pandas value_counts() method |
lambda df: df
|
modify_fn
|
Callable
|
Optional function to modify data before checking |
lambda df: df
|
subset
|
Union[str, List, None]
|
Optional list of columns or name of column to subset data before running check_fn |
None
|
check_name
|
Union[str, None]
|
Name to use when displaying check result |
None
|
Returns:
Type | Description |
---|---|
None
|
None |
_display_check(data, name=None)
Renders the result of a Pandas Checks method.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
data
|
Any
|
The data to display. |
required |
name
|
Union[str, None]
|
The optional name of the check. |
None
|
Returns:
Type | Description |
---|---|
None
|
None |
get_mode()
Returns whether Pandas Checks is currently running checks and assertions.
Returns:
Type | Description |
---|---|
Dict[str, bool]
|
A dictionary containing the current settings. |