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
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http://mail.scipy.org/mailman/listinfo/numpy-discussion

Reply via email to