dask.array.histogram2d

dask.array.histogram2d

dask.array.histogram2d(x, y, bins=10, range=None, normed=None, weights=None, density=None)[source]

Blocked variant of numpy.histogram2d().

Parameters
xdask.array.Array

An array containing the x-coordinates of the points to be histogrammed.

ydask.array.Array

An array containing the y-coordinates of the points to be histogrammed.

binssequence of arrays describing bin edges, int, or sequence of ints

The bin specification. See the bins argument description for histogramdd() for a complete description of all possible bin configurations (this function is a 2D specific version of histogramdd).

rangetuple of pairs, optional.

The leftmost and rightmost edges of the bins along each dimension when integers are passed to bins; of the form: ((xmin, xmax), (ymin, ymax)).

normedbool, optional

An alias for the density argument that behaves identically. To avoid confusion with the broken argument in the histogram function, density should be preferred.

weightsdask.array.Array, optional

An array of values weighing each sample in the input data. The chunks of the weights must be identical to the chunking along the 0th (row) axis of the data sample.

densitybool, optional

If False (the default) return the number of samples in each bin. If True, the returned array represents the probability density function at each bin.

Returns
dask.array.Array

The values of the histogram.

dask.array.Array

The edges along the x-dimension.

dask.array.Array

The edges along the y-dimension.

Examples

>>> import dask.array as da
>>> x = da.array([2, 4, 2, 4, 2, 4])
>>> y = da.array([2, 2, 4, 4, 2, 4])
>>> bins = 2
>>> range = ((0, 6), (0, 6))
>>> h, xedges, yedges = da.histogram2d(x, y, bins=bins, range=range)
>>> h
dask.array<sum-aggregate, shape=(2, 2), dtype=float64, chunksize=(2, 2), chunktype=numpy.ndarray>
>>> xedges
dask.array<array, shape=(3,), dtype=float64, chunksize=(3,), chunktype=numpy.ndarray>
>>> h.compute()
array([[2., 1.],
       [1., 2.]])