Skip to content

make axis['multiple;groups'] work #151

Description

@gdementen

I am not sure we should keep axis['a_string'] being interpreted, but if we do the title should work.

Salvaged from my comments in #145.

However (and this is a bit silly that I did not make it work -- but to my defense, I did not expect you to merge that PR), what you used as an example is broken at this point, because the result is not a valid index in an array:

>>> year = Axis('year', '2001..2010')
>>> year['2001:2004;2008;2009']
year[slice(2001, 2004, None), [2008, 2009]]
>>> arr = ndrange(year)
>>> arr.sum(year['2001:2004;2008,2009'])
TypeError                                 Traceback (most recent call last)
...
TypeError: unhashable type: 'slice'
>>> # this works though
... arr.sum(tuple(year['2001:2004;2008,2009']))
year | 2001:2004 | 2008,2009
     |         6 |        15

Activity

  1. gdementen commented on Sep 19, 2017

    @gdementen
    ContributorAuthor

    I think

    year['2001:2004;2008;2009']

    should be equivalent to

    (year[2001:2004], year[2008], year[2009])

    while

    year['2001:2004,2008,2009']

    should be equivalent to

    year[2001,2002,2003,2004,2008,2009]
  2. added this to the milestone on Jul 20, 2018
  3. removed this from the milestone on Aug 1, 2019
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

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions