staircase.Stairs.percentile#
- property Stairs.percentile#
This property returns a
staircase.Percentiles
object.Percentiles is a subclass of Stairs. Although it inherits all methods of Stairs, it is expected that it will typically only be used as a callable class, to calculate the x-th percentile with the following parameters.
- Parameters
- xint or array-like of int
Percentile or sequence of percentiles to compute,. Must be between 0 and 100.
- Returns
- float or
numpy.ndarray
of floats
- float or
See also
Examples
>>> sf = sc.Stairs().layer([0,1,2,3,4], [6,7,8,9,10]) >>> fig, axes = plt.subplots(ncols=2, figsize=(7,3), sharey=True) >>> sf.plot(axes[0]) >>> axes[0].set_title("sf") >>> sf.percentile.plot(axes[1]) >>> axes[1].set_title("percentile function")
>>> sf.percentile <staircase.Percentiles, id=2151414790944>
>>> sf.percentile(50) 3
>>> sf.percentile([25,50,75]) array([2., 3., 4.])