Skip to content

Better error message if attempt fancy indexing #89

@alimanfoo

Description

@alimanfoo

Currently if pass boolean array, get:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-24-06bb9af56726> in <module>()
----> 1 ann_vgsc_gene = callset['2L/variants/ANN'][loc1]
      2 ann_vgsc_gene

/home/aliman/miniconda3/envs/biipy240/lib/python3.5/site-packages/zarr/core.py in __getitem__(self, item)
    446 
    447         # normalize selection
--> 448         selection = normalize_array_selection(item, self._shape)
    449 
    450         # determine output array shape

/home/aliman/miniconda3/envs/biipy240/lib/python3.5/site-packages/zarr/util.py in normalize_array_selection(item, shape)
    176     elif isinstance(item, slice):
    177         item = (item,)
--> 178     elif item == Ellipsis:
    179         item = (slice(None),)
    180 

ValueError: The truth value of an array with more than one element is ambiguous. Use a.any() or a.all()

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew features or improvementsrelease notes doneAutomatically applied to PRs which have release notes.

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions