Skip to content

Array.insert fails if labels are ambiguous AND values has the axis #899

@gdementen

Description

@gdementen
>>> arr = ndtest('axis1=x1..x3;axis2=x1..x3')
>>> arr.insert(arr['axis1[x1,x2]'], before='axis1[x3]')
ValueError: ['x1'] is ambiguous (valid in axis1, axis2)

>>> # it works if the values has not the axis
>>> arr.insert(arr['axis1[x1]'], before='axis1[x3]', label='x1')
axis1\axis2  x1  x2  x3
         x1   0   1   2
         x2   3   4   5
         x1   0   1   2
         x3   6   7   8
>>> # it works if the labels are not ambiguous
>>> arr2 = arr.set_labels('axis2', str.upper)
>>> arr2.insert(arr2['axis1[x2,x1]'], before='axis1[x3]')
axis1\axis2  X1  X2  X3
         x1   0   1   2
         x2   3   4   5
         x2   3   4   5
         x1   0   1   2
         x3   6   7   8

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions