spiketools.utils.base.drop_key_prefix

spiketools.utils.base.drop_key_prefix(indict, prefix)[source]

Update keys of a dictionary by dropping a prefix.

Parameters:
indictdict

Dictionary to update keys for.

prefixstr

Prefix to drop from each dictionary key.

Returns:
dict

Dictionary with updated keys.

Examples

Drop a prefix from dictionary keys:

>>> indict = {'analysis_setting' : 12, 'analysis_param' : 22}
>>> drop_key_prefix(indict, 'analysis')
{'setting': 12, 'param': 22}