boost-histogram
boost-histogram copied to clipboard
[BUG] Filling with unsigned ints in IntCategory axis raises TypeError
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"
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.
Fixed in #917.