MCPcopy
hub / github.com/numpy/numpy / histogramdd

Function histogramdd

numpy/lib/_histograms_impl.py:914–1085  ·  view source on GitHub ↗

Compute the multidimensional histogram of some data. Parameters ---------- sample : (N, D) array, or (N, D) array_like The data to be histogrammed. Note the unusual interpretation of sample when an array_like: * When an array, each row is a coordinate in a

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

Source from the content-addressed store, hash-verified

912
913@array_function_dispatch(_histogramdd_dispatcher)
914def histogramdd(sample, bins=10, range=None, density=None, weights=None):
915 """
916 Compute the multidimensional histogram of some data.
917
918 Parameters
919 ----------
920 sample : (N, D) array, or (N, D) array_like
921 The data to be histogrammed.
922
923 Note the unusual interpretation of sample when an array_like:
924
925 * When an array, each row is a coordinate in a D-dimensional space -
926 such as ``histogramdd(np.array([p1, p2, p3]))``.
927 * When an array_like, each element is the list of values for single
928 coordinate - such as ``histogramdd((X, Y, Z))``.
929
930 The first form should be preferred.
931
932 bins : sequence or int, optional
933 The bin specification:
934
935 * A sequence of arrays describing the monotonically increasing bin
936 edges along each dimension.
937 * The number of bins for each dimension (nx, ny, ... =bins)
938 * The number of bins for all dimensions (nx=ny=...=bins).
939
940 range : sequence, optional
941 A sequence of length D, each an optional (lower, upper) tuple giving
942 the outer bin edges to be used if the edges are not given explicitly in
943 `bins`.
944 An entry of None in the sequence results in the minimum and maximum
945 values being used for the corresponding dimension.
946 The default, None, is equivalent to passing a tuple of D None values.
947 density : bool, optional
948 If False, the default, returns the number of samples in each bin.
949 If True, returns the probability *density* function at the bin,
950 ``bin_count / sample_count / bin_volume``.
951 weights : (N,) array_like, optional
952 An array of values `w_i` weighing each sample `(x_i, y_i, z_i, ...)`.
953 Weights are normalized to 1 if density is True. If density is False,
954 the values of the returned histogram are equal to the sum of the
955 weights belonging to the samples falling into each bin.
956
957 Returns
958 -------
959 H : ndarray
960 The multidimensional histogram of sample x. See density and weights
961 for the different possible semantics.
962 edges : tuple of ndarrays
963 A tuple of D arrays describing the bin edges for each dimension.
964
965 See Also
966 --------
967 histogram: 1-D histogram
968 histogram2d: 2-D histogram
969
970 Examples
971 --------

Callers 14

histogram2dFunction · 0.90
test_simpleMethod · 0.90
test_shape_3dMethod · 0.90
test_shape_4dMethod · 0.90
test_weightsMethod · 0.90
test_emptyMethod · 0.90
test_finite_rangeMethod · 0.90
test_equal_edgesMethod · 0.90
test_edge_dtypeMethod · 0.90
test_large_integersMethod · 0.90

Calls 9

_get_outer_edgesFunction · 0.85
sliceFunction · 0.85
linspaceMethod · 0.80
reshapeMethod · 0.80
astypeMethod · 0.80
indexMethod · 0.45
anyMethod · 0.45
prodMethod · 0.45
sumMethod · 0.45

Tested by 13

test_simpleMethod · 0.72
test_shape_3dMethod · 0.72
test_shape_4dMethod · 0.72
test_weightsMethod · 0.72
test_emptyMethod · 0.72
test_finite_rangeMethod · 0.72
test_equal_edgesMethod · 0.72
test_edge_dtypeMethod · 0.72
test_large_integersMethod · 0.72

Used in the wild real call sites across dependent graphs

searching dependent graphs…