staircase.
hist_from_ecdf
(ecdf, bin_edges=None, closed='left')¶Calculates a histogram from a Stairs instance corresponding to an empirical cumulative distribution function.
Such ecdf stair instances are returned from Stairs.ecdf_stairs()
. This function predominantly exists
to allow users to store the result of a ecdf stairs instance locally, and experiment with bin_edges without
requiring the recalculation of the ecdf.
Parameters: |
|
---|---|
Returns: | A Series, with a |
Return type: |
|
See also
Examples
>>> import staircase as sc
>>> s1_ecdf_stairs = s1.ecdf_stairs()
>>> fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(8,5), sharey=False, sharex=False)
>>> for ax, title, stair_instance in zip(axes, ("s1", "s1 ecdf"), (s1, s1_ecdf_stairs)):
... stair_instance.plot(ax)
... ax.set_title(title)
>>> plt.show()
>>> sc.hist_from_ecdf(s1_ecdf_stairs)
[-1, 0) 0.25
[0, 1) 0.25
[1, 2) 0.50
dtype: float64
>>> sc.hist_from_ecdf(s1_ecdf_stairs, bin_edges=(-1,1,3))
[-1, 1) 0.5
[1, 3) 0.5
dtype: float64