histogram_bin_edges(a, bins=10, range=None, weights=None)¶
Function to calculate only the edges of the bins used by the histogram function.
String values for bins is not supported.
bins ((Union[int, tuple, list, Tensor])) – If bins is an int, it defines the number of equal-width bins in the given range (10, by default). If bins is a sequence, it defines the bin edges, including the rightmost edge, allowing for non-uniform bin widths.
range ((float, float), optional) – The lower and upper range of the bins. If not provided, range is simply
(a.min(), a.max()). Values outside the range are ignored. The first element of the range must be less than or equal to the second. Default is None.
weights (Union[int, float, bool, list, tuple, Tensor], optional) – An array of weights, of the same shape as a. Each value in a only contributes its associated weight towards the bin count (instead of 1). This is currently not used by any of the bin estimators, but may be in the future. Default is None.
Tensor, the edges to pass into histogram.
- Supported Platforms:
TypeError – if bins is an array and not one-dimensional.
>>> import mindspore.numpy as np >>> arr = np.array([0, 0, 0, 1, 2, 3, 3, 4, 5]) >>> print(np.histogram_bin_edges(arr, bins=2)) [0. 2.5 5. ]