boost-histogram icon indicating copy to clipboard operation
boost-histogram copied to clipboard

[BUG] Filling with unsigned ints in IntCategory axis raises TypeError

Open tcuisset opened this issue 2 years ago • 1 comments

Describe the bug Filling an histogram with unsigned ints in IntCategory axis raises TypeError : "Only integer arrays supported when targeting integer axes". I believe this used to work in version 1.3

Steps to reproduce

import boost_histogram as bh
import numpy as np
h = bh.Histogram(bh.axis.IntCategory([0, 1]))
h.fill(np.array([0], dtype="int32")) # works
h.fill(np.array([0], dtype="uint32")) # raises TypeError :  "Only integer arrays supported when targeting integer axes"

tcuisset avatar Nov 21 '23 09:11 tcuisset

It worked incorrectly for floats. I’d agree that uint would be nice to supported, though it will be doing a conversion internally since the fill routines are compiled with 64 bit signed ints. At the very least the error message can be improved.

henryiii avatar Nov 21 '23 14:11 henryiii

Fixed in #917.

henryiii avatar Aug 23 '24 20:08 henryiii