Skip to content

creating an Axis with mixed type does not work #910

Open

Description

@gdementen
>>> Axis([0, "a"], "value")
Axis(['0', 'a'], 'value')

The only workaround I know is to force the dtype at the numpy level:

>>> Axis(np.array([0, "a"], dtype=object), "value")
Axis([0, 'a'], 'value')

Activity

  1. gdementen commented on Feb 19, 2021

    @gdementen
    ContributorAuthor

    AFAICT, we will need to traverse all labels to fix this, which is most unfortunate for larger axes. One way to prevent traversing all labels would be to keep the labels as a list when given as a list, which would have the added bonus of being more efficient in some cases, but that would make the code more complex in a few places and could lead to subtle errors, so I think it is probably not worth it. I would have to think some more about the consequences of this (maybe keeping it as a list until we need it as an array would be doable -- be then we are back at the original issue).

  2. added this to the 0.34 milestone on Jul 30, 2021
  3. modified the milestones: 0.34, 0.35 on Sep 13, 2022
  4. modified the milestones: 0.35, 0.36 on Sep 11, 2023
  5. gdementen commented on Oct 25, 2023

    @gdementen
    ContributorAuthor

    Implementing a dtype argument on Axis, would make the workaround less awful. But that would clearly not be enough (I don't want users to have to specify dtype manually, except maybe to gain performance)

  6. modified the milestones: 0.36, 0.37 on Oct 6, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions