Stairs#

class staircase.Stairs#

Constructor & basic methods#

Stairs.__init__([frame, start, end, value, ...])

Objects of class Stairs are used to represent a step function.

Stairs.copy()

Returns a deep copy of this Stairs instance

Stairs.from_values([initial_value, values, ...])

Construct Stairs from pandas.Series.

Stairs.sample(x[, include_index])

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

Stairs.limit(x, side[, include_index])

Evaluates the limit of the step function as it approaches one, or more, points.

Stairs.layer([start, end, value, frame])

Changes the values of the step function, in place, by 'layering' one or more intervals.

Stairs.step_changes

A pandas Series of key, value pairs of indicating where step changes occur in the step function, and the change in value

Stairs.step_values

A pandas Series of key, value pairs of indicating where step changes occur in the step function, and the limit of the step function when it approaches these points from the right.

Stairs.step_points

A numpy arrauy of domain values indicating where step changes occur in the step function.

Stairs.to_frame()

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)

A binary operator facilitating the addition of step functions (and floats).

Stairs.subtract(other)

A binary operator facilitating the subtraction of step functions (and floats).

Stairs.multiply(other)

A binary operator facilitating the multiplication of step functions (and floats).

Stairs.divide(other)

A binary operator facilitating the division of step functions (and floats).

Stairs.radd(other)

A binary operator facilitating the addition of step functions (and floats).

Stairs.rsubtract(other)

A binary operator facilitating the subtraction of step functions (and floats).

Stairs.rmultiply(other)

A binary operator facilitating the multiplication of step functions (and floats).

Stairs.rdivide(other)

A binary operator facilitating the division of step functions (and floats).

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)

A boolean comparison for Stairs instances.

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.

Stairs.logical_xor(other)

Returns a boolean-valued step function indicating where self xor other are non-zero.

Stairs.logical_rand(other)

Returns a boolean-valued step function indicating where self and other are non-zero.

Stairs.logical_ror(other)

Returns a boolean-valued step function indicating where self or other are non-zero.

Stairs.logical_rxor(other)

Returns a boolean-valued step function indicating where self xor other are non-zero.

Statistical operators#

Stairs.cov(other[, where, lag, clip])

Calculates either covariance, autocovariance or cross-covariance.

Stairs.corr(other[, where, lag, clip])

Calculates either correlation, autocorrelation or cross-correlation.

Summary statistics#

Stairs.number_of_steps

Calculates the number of step changes

Stairs.integral()

The integral of the step function.

Stairs.describe([where, percentiles])

Generate descriptive statistics for the step function values over a specified domain.

Stairs.agg(name[, where, closed])

Returns the aggregation of the step function defined over a domain.

Stairs.values_in_range([where, closed])

Returns the range (i.e.

Stairs.min()

The minimum of the step function.

Stairs.max()

The maximum of the step function.

Stairs.var()

The variance of the step function.

Stairs.std()

The standard deviation of the step function.

Stairs.mode()

The mode of the step function.

Stairs.mean()

The mean of the step function.

Stairs.median()

The median of the step function.

Stairs.value_sums([dropna, group])

Characterises the distribution of step function values with a series of their sums.

Stairs.percentile

This property returns a staircase.Percentiles object.

Stairs.fractile

This property returns a staircase.Fractiles object.

Stairs.quantiles(q)

Returns an array of q-quantiles.

Stairs.ecdf

Calculates an empirical cumulative distribution function for the corresponding step function values.

Stairs.hist([bins, closed, stat])

Calculates histogram data for the corresponding step function values

Plotting#

Stairs.plot([x, y, kind, ax, ....])

Stairs plotting accessor and method

Miscellaneous functions#

Stairs.clip([lower, upper])

Returns a copy of self which is undefined everywhere outside of [lower, upper]

Stairs.mask(other)

Returns a new step function where self has been masked by other.

Stairs.where(other)

Returns a new step function where self has been 'inversely masked' by other.

Stairs.isna()

Returns a new 'boolean valued' step function indicating where the domain of self is not defined.

Stairs.notna()

Returns a new 'boolean valued' step function indicating where the domain of self is not defined.

Stairs.fillna(value)

Define values for (a copy of) self where it is undefined.

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, where])

Returns coordinates defining rolling mean

Stairs.slice(cuts[, closed])

Slice the step function into pieces.

Stairs.pipe(func, *args, **kwargs)

Applies func and returns the result.