Skip to content

Either handle or disallow setting axes via Array.__setattr__ #1200

Description

@gdementen

It can be natural to change an axis using setattr (as gb tried to do) but it leads to a very confusing problem where the real array axis is different from the attribute axis. For example, to change the type of an axis:

>>> arr = ndtest('a=1,2,total')[:'2']
>>> arr.a.dtype
dtype('<U21')
>>> arr.a = arr.a.astype(int)
>>> arr.a.dtype
dtype('int64')
>>> arr.axes['a'].dtype
dtype('<U21')
>>> arr.a is arr.axes['a']
False

We should either make it work or make it an explicit error.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions