datawrangler.core

datawrangler.core.get_default_options(fname=None)[source]

Parse a config.ini file

Parameters

param fname:

absolute-path filename for the config.ini file (default: data-wrangler/datawrangler/core/config.ini)

Returns

return:

A dictionary whose keys are function names and whose values are dictionaries of default arguments and keyword arguments

datawrangler.core.apply_defaults(f, defaults=None)[source]

Replace a function’s default arguments and keyword arguments with defaults specified in config.ini

Parameters

param f:

a function

param defaults:

an optional dictionary of default options (default: get_default_options)

Returns

return:

a function replacing and un-specified arguments with the defaults defined in config.ini

datawrangler.core.update_dict(template, updates, from_config=False)[source]

Replace a template dictionary’s values with new values defined in a second “updates” dictionary.

Parameters

param template:

default keys and values to use (if not specified in the “updates” dictionary)

param updates:

new values to use (and/or new keys to add to the resulting dictionary)

param from_config:

if True, evaluate the keys in the “template” dictionary and set their values to the result. Used when loading options from the configuration file. (Default: False)

Returns

return:

A new dictionary containing the union of the keys/values in template and updates, with preference given to the updates dictionary

datawrangler.core.set_dataframe_backend(backend)[source]

Set the global DataFrame backend preference.

Parameters

backendstr

The backend to use (‘pandas’ or ‘polars’)

Raises

ValueError

If backend is not ‘pandas’ or ‘polars’

datawrangler.core.get_dataframe_backend()[source]

Get the current global DataFrame backend preference.

Returns

str

The current backend (‘pandas’ or ‘polars’)

datawrangler.core.reset_dataframe_backend()[source]

Reset the DataFrame backend to the default (pandas).