predictably.set_config#

predictably.set_config(*, dataframe_backend: Literal['polars', 'pandas', 'fugue', 'input'] | None = None, math_backend: Literal['predictably', 'numba', 'numpy'] | None = None, print_changed_only: bool | None = None, display: Literal['text', 'diagram'] | None = None, local_threadsafe: bool = False) None[source]#

Set global configuration.

Allows the predictably global configuration to be updated.

Parameters:
dataframe_backend{“polars”, “pandas”, “fugue”, “input”}, default=None

The dataframe backend to use internally in predictably.

  • If “polars”, “pandas”, or “fugue” then input data will be converted to the specified type as necessary.

  • If “input” then the dataframe will be processed using the type of its input. For example, if the input is a polars.DataFrame or polars.LazyFrame it will be processed as a polars.LazyFrame.

math_backend{“predictably”, “numba”, “numpy”}, default=None

The backend to use for mathematical processing.

  • If “predictably” than predictably’s internal methods, including pre-compiled Rust code.

  • If “numba” or “numpy” then math and linear algebra processing will use numba or numpy, respectively.

print_changed_onlybool, default=None

If True, only the parameters that were set to non-default values will be printed when printing a BaseObject instance. For example, print(SVC()) while True will only print ‘SVC()’, but would print ‘SVC(C=1.0, cache_size=200, …)’ with all the non-changed parameters when False. If None, the existing value won’t change.

display{‘text’, ‘diagram’}, default=None

If ‘diagram’, instances inheriting from BaseOBject will be displayed as a diagram in a Jupyter lab or notebook context. If ‘text’, instances inheriting from BaseObject will be displayed as text. If None, the existing value won’t change.

local_threadsafebool, default=False

If False, set the backend as default for all threads.

Returns:
None

No output returned.

See also

config_context

Configuration context manager.

get_default_config

Retrieve predictably’s default configuration.

get_config

Retrieve current global configuration values.

reset_config

Reset configuration to default.

Examples

>>> from predictably import get_config, set_config
>>> get_config()  
{'dataframe_backend': 'polars', ..., 'display': 'text'}
>>> set_config(display='diagram')
>>> get_config()  
{'dataframe_backend': 'polars', ..., 'display': 'diagram'}