staircase.Stairs.hist¶
-
Stairs.
hist
(lower=-inf, upper=inf, bin_edges=None, closed='left')¶ Calculates a histogram for the corresponding step function values
Parameters: - lower (int, float or pandas.Timestamp, optional) – lower bound of the step-function domain on which to perform the calculation
- upper (int, float or pandas.Timestamp, optional) – upper bound of the step-function domain to perform the calculation
- bin_edges (array-like of int or float, optional) – defines the bin edges for the histogram (remember it is the step-function range that is being binned). If not specified the bin_edges will be assumed to be the integers which cover the step function range
- closed ({'left', 'right'}, default 'left') – determines whether the bins, which are half-open intervals, are left-closed , or right-closed
Returns: A Series, with a
pandas.IntervalIndex
, representing the values of the histogramReturn type: pandas.Series
Examples
>>> s1.plot()
>>> s1.hist() [-1, 0) 0.25 [0, 1) 0.25 [1, 2) 0.50 dtype: float64
>>> s1.hist(closed='right') (-2, -1] 0.25 (-1, 0] 0.25 (0, 1] 0.50 dtype: float64
>>> s1.hist(2, 4.5) [-1, 0) 0.2 [0, 1) 0.4 [1, 2) 0.4 dtype: float64
>>> s1.hist(bin_edges=(-1,1,3)) [-1, 1) 0.5 [1, 3) 0.5 dtype: float64
>>> s1.hist(bin_edges=(-1, 1)) [-1, 1) 0.5 dtype: float64