[Numpy-discussion] np.histogramdd of empty data
Nils Becker
n.becker@amolf...
Tue Mar 22 05:28:51 CDT 2011
Hi,
I was wondering why histogram2d and histogramdd raise a ValueError when
fed with empty data of the correct dimensions. I came across this as a
corner case when calling histogram2d from my own specialized histogram
function.
In comparison, histogram does handle this case correctly when bins are
specified explicitely (obviously automatic binning cannot work without
data...)
np.histogram([], bins=([0,1]))
(array([0]), array([0, 1]))
np.histogram2d([],[], bins=([0,1],[0,1]))
ValueError: zero-size array to ufunc.reduce without identity
np.histogramdd([[],[]], bins=([0,1],[0,1]))
ValueError: zero-size array to ufunc.reduce without identity
cheers, nils
More information about the NumPy-Discussion
mailing list