MCPcopy Create free account
hub / github.com/dask/dask / histogramdd

Function histogramdd

dask/array/routines.py:1184–1521  ·  view source on GitHub ↗

Blocked variant of :func:`numpy.histogramdd`. Chunking of the input data (``sample``) is only allowed along the 0th (row) axis (the axis corresponding to the total number of samples). Data chunked along the 1st axis (column) axis is not compatible with this function. If weights are

(sample, bins, range=None, normed=None, weights=None, density=None)

Source from the content-addressed store, hash-verified

1182
1183
1184def histogramdd(sample, bins, range=None, normed=None, weights=None, density=None):
1185 """Blocked variant of :func:`numpy.histogramdd`.
1186
1187 Chunking of the input data (``sample``) is only allowed along the
1188 0th (row) axis (the axis corresponding to the total number of
1189 samples). Data chunked along the 1st axis (column) axis is not
1190 compatible with this function. If weights are used, they must be
1191 chunked along the 0th axis identically to the input sample.
1192
1193 An example setup for a three dimensional histogram, where the
1194 sample shape is ``(8, 3)`` and weights are shape ``(8,)``, sample
1195 chunks would be ``((4, 4), (3,))`` and the weights chunks would be
1196 ``((4, 4),)`` a table of the structure:
1197
1198 +-------+-----------------------+-----------+
1199 | | sample (8 x 3) | weights |
1200 +=======+=====+=====+=====+=====+=====+=====+
1201 | chunk | row | `x` | `y` | `z` | row | `w` |
1202 +-------+-----+-----+-----+-----+-----+-----+
1203 | | 0 | 5 | 6 | 6 | 0 | 0.5 |
1204 | +-----+-----+-----+-----+-----+-----+
1205 | | 1 | 8 | 9 | 2 | 1 | 0.8 |
1206 | 0 +-----+-----+-----+-----+-----+-----+
1207 | | 2 | 3 | 3 | 1 | 2 | 0.3 |
1208 | +-----+-----+-----+-----+-----+-----+
1209 | | 3 | 2 | 5 | 6 | 3 | 0.7 |
1210 +-------+-----+-----+-----+-----+-----+-----+
1211 | | 4 | 3 | 1 | 1 | 4 | 0.3 |
1212 | +-----+-----+-----+-----+-----+-----+
1213 | | 5 | 3 | 2 | 9 | 5 | 1.3 |
1214 | 1 +-----+-----+-----+-----+-----+-----+
1215 | | 6 | 8 | 1 | 5 | 6 | 0.8 |
1216 | +-----+-----+-----+-----+-----+-----+
1217 | | 7 | 3 | 5 | 3 | 7 | 0.7 |
1218 +-------+-----+-----+-----+-----+-----+-----+
1219
1220 If the sample 0th dimension and weight 0th (row) dimension are
1221 chunked differently, a ``ValueError`` will be raised. If
1222 coordinate groupings ((x, y, z) trios) are separated by a chunk
1223 boundary, then a ``ValueError`` will be raised. We suggest that you
1224 rechunk your data if it is of that form.
1225
1226 The chunks property of the data (and optional weights) are used to
1227 check for compatibility with the blocked algorithm (as described
1228 above); therefore, you must call `to_dask_array` on a collection
1229 from ``dask.dataframe``, i.e. :class:`dask.dataframe.Series` or
1230 :class:`dask.dataframe.DataFrame`.
1231
1232 The function is also compatible with `x`, `y`, and `z` being
1233 individual 1D arrays with equal chunking. In that case, the data
1234 should be passed as a tuple: ``histogramdd((x, y, z), ...)``
1235
1236 Parameters
1237 ----------
1238 sample : dask.array.Array (N, D) or sequence of dask.array.Array
1239 Multidimensional data to be histogrammed.
1240
1241 Note the unusual interpretation of a sample when it is a

Callers 1

histogram2dFunction · 0.85

Calls 13

sumMethod · 0.95
is_dask_collectionFunction · 0.90
flattenFunction · 0.90
ArrayClass · 0.90
asarrayFunction · 0.90
anyFunction · 0.85
allFunction · 0.85
from_collectionsMethod · 0.80
reshapeMethod · 0.80
diffMethod · 0.80
tokenizeFunction · 0.50
__dask_keys__Method · 0.45

Tested by

no test coverage detected