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

Function histogramdd

numpy/lib/histograms.py:902–1072  ·  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

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

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
ndimMethod · 0.80
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