staircase.Stairs.resample

Stairs.resample(x, how='right', aggfunc=None, window=(0, 0), lower_how='right', upper_how='left')

Evaluates the value of the step function at one, or more, points and creates a new Stairs instance whose step changes occur at a subset of these points. The new instance and self have the same values when evaluated at x.

Parameters:
  • x (int, float or vector data) – Values at which to evaluate the function
  • how ({'left', 'right'}, default 'right') – If points where step changes occur do not coincide with x then this parameter has no effect. Where a step changes occurs at a point given by x, this parameter determines if the step function is evaluated at the interval to the left, or the right.
  • aggfunc ({'mean', 'median', 'mode', 'max', 'min', 'std', None}. Default None.) – A string corresponding to the aggregating function
  • window (array-like of int, float or pandas.Timedelta, optional) – Only relevant if aggfunc is not None. Should be length of 2. Defines distances from focal point to window boundaries.
  • lower_how ({'left', 'right'}, default 'right') – Only relevant if aggfunc is not None. Determines how the left window boundary should be evaluated. If ‘left’ then \(\lim_{x \to lower_how^{-}} f(x)\) is included in the window.
  • upper_how ({'left', 'right'}, default 'left') – Only relevant if aggfunc is not None. Determines how the right window boundary should be evaluated. If ‘right’ then \(\lim_{x \to upper_how^{+}} f(x)\) is included in the window.
Returns:

Return type:

Stairs

See also

staircase.resample()

Examples

>>> stair_list = [s1, s1.resample([1.5,2.5,4,4.5])]
>>> fig, axes = plt.subplots(nrows=1, ncols=2, figsize=(12,5), sharey=True, sharex=True)
>>> for ax, title, stair_instance in zip(axes, ("s1", "s1 resampled"), stair_list):
...     stair_instance.plot(ax)
...     ax.set_title(title)
../_images/staircase-Stairs-resample-1.png