plydata.cat_tools.cat_expand

plydata.cat_tools.cat_expand(c, *args)[source]

Add additional categories to a categorical

Parameters
clist-like

Values that will make up the categorical.

*argstuple

Categories to add.

Examples

>>> cat_expand(list('abc'), 'd', 'e')
['a', 'b', 'c']
Categories (5, object): ['a', 'b', 'c', 'd', 'e']
>>> c = pd.Categorical(list('abcd'), ordered=True)
>>> cat_expand(c, 'e', 'f')
['a', 'b', 'c', 'd']
Categories (6, object): ['a' < 'b' < 'c' < 'd' < 'e' < 'f']