staircase.Stairs.sample#

Stairs.sample(x: int | float | np.array | pd.Series, include_index=False) pd.Series#

Evaluates the value of the step function at one, or more, points.

The function can be called using parentheses. See example below.

Parameters:
xint, float or vector data

Values at which to evaluate the function

include_indexbool, default False

Indicates if the values returned should be a numpy.ndarray, or in a pandas.Series indexed by the values in x

Returns:
float, numpy.ndarray, pandas.Series

Examples

>>> s3.plot(arrows=True)
../../_images/staircase-Stairs-sample-1.png
>>> s3(1.5)
1
>>> s3(3)
nan
>>> s3([1, 3, 4])
array([ 1., nan, -1.])