# Stairs methods¶

## Constructor & basic methods¶

 Stairs([value, use_dates, tz]) An instance of a Stairs class is used to represent a step function. Stairs.copy([deep]) Returns a deep copy of this Stairs instance Stairs.plot([ax]) Makes a step plot representing the finite intervals belonging to the Stairs instance. Stairs.sample(x[, how, aggfunc, window, …]) Evaluates the value of the step function at one, or more, points. Stairs.layer([start, end, value]) Changes the value of the step function. Stairs.step_changes() Returns a dictionary of key, value pairs of indicating where step changes occur in the step function, and the change in value Stairs.to_dataframe() Returns a pandas.DataFrame with columns ‘start’, ‘end’ and ‘value’

## Arithmetic operators¶

 Stairs.negate() An operator which produces a new Stairs instance representing the multiplication of the step function by -1. Stairs.add(other) An operator facilitating the addition of two step functions. Stairs.subtract(other) An operator facilitating the subtraction of one step function from another. Stairs.multiply(other) An operator facilitating the multiplication of one step function with another. Stairs.divide(other) An operator facilitating the division of one step function by another.

## Relational operators¶

 Stairs.lt(other) Returns a boolean-valued step function indicating where self is strictly less than other. Stairs.gt(other) Returns a boolean-valued step function indicating where self is strictly greater than other. Stairs.le(other) Returns a boolean-valued step function indicating where self is less than, or equal to, other. Stairs.ge(other) Returns a boolean-valued step function indicating where self is greater than, or equal to, other. Stairs.eq(other) Returns a boolean-valued step function indicating where self is equal to other. Stairs.ne(other) Returns a boolean-valued step function indicating where self is not equal to other. Stairs.identical(other) Returns True if self and other represent the same step functions.

## Logical operators¶

 Stairs.make_boolean() Returns a boolean-valued step function indicating where self is non-zero. Stairs.invert() Returns a boolean-valued step function indicating where self is zero-valued. Stairs.logical_and(other) Returns a boolean-valued step function indicating where self and other are non-zero. Stairs.logical_or(other) Returns a boolean-valued step function indicating where self or other are non-zero.

## Statistical operators¶

 Stairs.cov(other[, lower, upper, lag, clip]) Calculates either covariance, autocovariance or cross-covariance. Stairs.corr(other[, lower, upper, lag, clip]) Calculates either correlation, autocorrelation or cross-correlation.

## Summary statistics¶

 Stairs.number_of_steps() Calculates the number of step changes Stairs.get_integral_and_mean([lower, upper]) Calculates the integral, and the mean of the step function. Stairs.integrate([lower, upper]) Calculates the integral of the step function. Stairs.describe([lower, upper, percentiles]) Generate descriptive statistics. Stairs.min([lower, upper, lower_how, upper_how]) Calculates the minimum value of the step function Stairs.max([lower, upper, lower_how, upper_how]) Calculates the maximum value of the step function Stairs.var([lower, upper]) Calculates the variance of the step function. Stairs.std([lower, upper]) Calculates the standard deviation of the step function. Stairs.mean([lower, upper]) Calculates the mean of the step function. Stairs.median([lower, upper]) Calculates the median of the step function. Stairs.percentile(x[, lower, upper]) Calculates the x-th percentile of the step function’s values Stairs.percentile_stairs([lower, upper]) Calculates a percentile function (and returns a corresponding Stairs instance) Stairs.ecdf_stairs([lower, upper]) Calculates an empirical cumulative distribution function for the corresponding step function values (and returns the result as a Stairs instance) Stairs.hist([lower, upper, bin_edges, closed]) Calculates a histogram for the corresponding step function values

## Miscellaneous functions¶

 Stairs.clip([lower, upper]) Returns a copy of self which is zero-valued everywhere outside of [lower, upper) Stairs.shift(delta) Returns a stairs instance corresponding to a horizontal translation by delta Stairs.diff(delta) Returns a stairs instance corresponding to the difference between the step function corresponding to self and the same step-function translated by delta. Stairs.rolling_mean([window, lower, upper]) Returns coordinates defining rolling mean Stairs.resample(x[, how, aggfunc, window]) 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. Stairs.clip([lower, upper]) Returns a copy of self which is zero-valued everywhere outside of [lower, upper)