Skip to content

Options

Utilities for configuring Pandas Checks options.

This module provides functions for setting and managing global options for Pandas Checks, including formatting and disabling checks and assertions.

_initialize_format_options(options=None)

Initializes or resets Pandas Checks formatting options.

Parameters:

Name Type Description Default
options Union[List[str], None]

A list of option names to initialize or reset. If None, all formatting options will be initialized or reset.

None

Returns: None

Note

We separate this function from _initialize_options() so user can reset just formatting without changing mode

_initialize_options()

Initializes (or resets) all Pandas Checks options to their default values.

Returns:

Type Description
None

None

Note

We separate this function from _initialize_format_options() so user can reset just formatting if desired without changing mode

_register_option(name, default_value, description, validator)

Registers a Pandas Checks option in the global Pandas context manager.

If the option has already been registered, reset its value.

This method enables setting global formatting for Pandas Checks results and storing variables that will persist across Pandas method chains, which return newly initialized DataFrames at each method (and so reset the DataFrame's attributes).

Parameters:

Name Type Description Default
name str

The name of the option to register.

required
default_value Any

The default value for the option.

required
description str

A description of the option.

required
validator Callable

A function to validate the option value.

required

Returns:

Type Description
None

None

Note

For more details on the arguments, see the documentation for pandas._config.config.register_option()

_set_option(option, value)

Updates the value of a Pandas Checks option in the global Pandas context manager.

Parameters:

Name Type Description Default
option str

The name of the option to set.

required
value Any

The value to set for the option.

required

Returns:

Type Description
None

None

Raises:

Type Description
AttributeError

If the option is not a valid Pandas Checks option.

describe_options()

Prints all global options for Pandas Checks, their default values, and current values.

Returns:

Type Description
None

None

disable_checks(enable_asserts=True)

Turns off all calls to Pandas Checks methods and optionally enables or disables check.assert_data(). Does not modify the DataFrame itself.

If this function is called, subequent calls to .check functions will not be run.

Typically used to 1) Globally switch off Pandas Checks, such as during production. or 2) Temporarily switch off Pandas Checks, such as for a stable part of a notebook.

Parameters:

Name Type Description Default
enable_asserts bool

Whether to also run calls to Pandas Checks .check.assert_data()

True

Returns:

Type Description
None

None

enable_checks(enable_asserts=True)

Turns on Pandas Checks globally. Subsequent calls to .check methods will be run.

Parameters:

Name Type Description Default
enable_asserts bool

Whether to also enable or disable check.assert_data().

True

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.

reset_format()

Globally restores all Pandas Checks formatting options to their default "factory" settings.

Returns:

Type Description
None

None

set_format(**kwargs)

Configures selected formatting options for Pandas Checks. Run pandas_checks.describe_options() to see a list of available options.

For example, set_format(check_text_tag= "h1", use_emojis=False`) will globally change Pandas Checks to display text results as H1 headings and remove all emojis.

Returns:

Type Description
None

None

Parameters:

Name Type Description Default
**kwargs Any

Pairs of setting name and its new value.

{}

set_mode(enable_checks, enable_asserts)

Configures the operation mode for Pandas Checks globally.

Parameters:

Name Type Description Default
enable_checks bool

Whether to run any Pandas Checks methods globally. Does not affect .check.assert_data().

required
enable_asserts bool

Whether to run calls to .check.assert_data() globally.

required

Returns:

Type Description
None

None