diff --git a/numpy/lib/histograms.py b/numpy/lib/histograms.py index 98182f1c4b03..194ee6ce2620 100644 --- a/numpy/lib/histograms.py +++ b/numpy/lib/histograms.py @@ -1019,7 +1019,7 @@ def histogramdd(sample, bins=10, range=None, normed=None, weights=None, sample = np.atleast_2d(sample).T N, D = sample.shape - nbin = np.empty(D, int) + nbin = np.empty(D, np.intp) edges = D*[None] dedges = D*[None] if weights is not None: diff --git a/numpy/lib/tests/test_histograms.py b/numpy/lib/tests/test_histograms.py index 1a1327c84990..14423f6f5e48 100644 --- a/numpy/lib/tests/test_histograms.py +++ b/numpy/lib/tests/test_histograms.py @@ -6,6 +6,7 @@ assert_array_almost_equal, assert_raises, assert_allclose, assert_array_max_ulp, assert_raises_regex, suppress_warnings, ) +from numpy.testing._private.utils import requires_memory import pytest @@ -421,6 +422,16 @@ def test_histogram_bin_edges(self): edges = histogram_bin_edges(arr, bins='auto', range=(0, 1)) assert_array_equal(edges, e) + @requires_memory(free_bytes=1e10) + @pytest.mark.slow + def test_big_arrays(self): + sample = np.zeros([100000000, 3]) + xbins = 400 + ybins = 400 + zbins = np.arange(16000) + hist = np.histogramdd(sample=sample, bins=(xbins, ybins, zbins)) + assert_equal(type(hist), type((1, 2))) + class TestHistogramOptimBinNums: """