Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] More informative indexing errors (for category indexing) #330

Closed
andrzejnovak opened this issue Oct 11, 2021 · 1 comment
Closed
Assignees
Labels
enhancement New feature or request

Comments

@andrzejnovak
Copy link
Member

Consider:

w = 1e-2  
x = np.random.normal(loc=0.5, scale=0.2, size=1000)
axes = 'ABCDEFG'
h = hist.Hist(
          *[hist.axis.StrCategory([], name=name, growth=True) for name in axes],
          hist.axis.Regular(3, 0, 1, name="x", label="axis"),   
    )
h.fill(**{k :np.random.choice(list("ABCDEFG"), 1000) for k in axes}, **{"x":x})

h[{"A" : "X"}]

Yields:

IndexError: index 7 is out of bounds for axis 0 with size 7

If the IndexError showed the unconverted value as well as name of the axis it would be great

@andrzejnovak andrzejnovak added the enhancement New feature or request label Oct 11, 2021
@henryiii
Copy link
Member

Related to scikit-hep/boost-histogram#387

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants