Skip to content

generalize set_labels to support group keys #906

Open
@gdementen

Description

@gdementen

As hinted in #361 and a follow-up to #634, it would often be useful to support group keys in set_labels:

>>> arr = ndtest(10)
>>> arr
a  a0  a1  a2  a3  a4  a5  a6  a7  a8  a9
    0   1   2   3   4   5   6   7   8   9
>>> arr.set_labels({'a1,a3,a4': 'a134', 'a6,a8': 'a68'})
a  a0  a134  a2  a134  a134  a5  a68  a7  a68  a9
    0     1   2     3     4   5    6   7    8   9

>>> arr = ndtest("a=01..10").with_total()
>>> arr
a  01  02  03  04  05  06  07  08  09  10  total
    0   1   2   3   4   5   6   7   8   9     45
>>> arr.set_labels({'01..10': int})
a  1  2  3  4  5  6  7  8  9  10  total
   0  1  2  3  4  5  6  7  8   9     45

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions