staircase.
Stairs
(value=0, use_dates=<staircase.stairs.Default object>, tz=<staircase.stairs.Default object>)¶An instance of a Stairs class is used to represent a step function.
The Stairs class encapsulates a SortedDict which is used to hold the points at which the step function changes, and by how much.
See the Stairs API for details of methods.
__init__
(value=0, use_dates=<staircase.stairs.Default object>, tz=<staircase.stairs.Default object>)¶Initialise a Stairs instance.
Parameters: |
|
---|---|
Returns: | |
Return type: |
Methods
__init__ ([value, use_dates, tz]) |
Initialise a Stairs instance. |
add (other) |
An operator facilitating the addition of two step functions. |
clip ([lower, upper]) |
Returns a copy of self which is zero-valued everywhere outside of [lower, upper) |
copy ([deep]) |
Returns a deep copy of this Stairs instance |
corr (other[, lower, upper, lag, clip]) |
Calculates either correlation, autocorrelation or cross-correlation. |
cov (other[, lower, upper, lag, clip]) |
Calculates either covariance, autocovariance or cross-covariance. |
describe ([lower, upper, percentiles]) |
Generate descriptive statistics. |
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. |
divide (other) |
An operator facilitating the division of one step function by another. |
ecdf_stairs ([lower, upper]) |
Calculates an empirical cumulative distribution function for the corresponding step function values (and returns the result as a Stairs instance) |
eq (other) |
Returns a boolean-valued step function indicating where self is equal to other. |
ge (other) |
Returns a boolean-valued step function indicating where self is greater than, or equal to, other. |
get_integral_and_mean ([lower, upper]) |
Calculates the integral, and the mean of the step function. |
gt (other) |
Returns a boolean-valued step function indicating where self is strictly greater than other. |
hist ([lower, upper, bin_edges, closed]) |
Calculates a histogram for the corresponding step function values |
identical (other) |
Returns True if self and other represent the same step functions. |
integrate ([lower, upper]) |
Calculates the integral of the step function. |
invert () |
Returns a boolean-valued step function indicating where self is zero-valued. |
layer ([start, end, value]) |
Changes the value of the step function. |
le (other) |
Returns a boolean-valued step function indicating where self is less than, or equal to, other. |
logical_and (other) |
Returns a boolean-valued step function indicating where self and other are non-zero. |
logical_or (other) |
Returns a boolean-valued step function indicating where self or other are non-zero. |
lt (other) |
Returns a boolean-valued step function indicating where self is strictly less than other. |
make_boolean () |
Returns a boolean-valued step function indicating where self is non-zero. |
max ([lower, upper, lower_how, upper_how]) |
Calculates the maximum value of the step function |
mean ([lower, upper]) |
Calculates the mean of the step function. |
median ([lower, upper]) |
Calculates the median of the step function. |
min ([lower, upper, lower_how, upper_how]) |
Calculates the minimum value of the step function |
mode ([lower, upper]) |
Calculates the mode of the step function. |
multiply (other) |
An operator facilitating the multiplication of one step function with another. |
ne (other) |
Returns a boolean-valued step function indicating where self is not equal to other. |
negate () |
An operator which produces a new Stairs instance representing the multiplication of the step function by -1. |
number_of_steps () |
Calculates the number of step changes |
percentile (x[, lower, upper]) |
Calculates the x-th percentile of the step function’s values |
percentile_Stairs ([lower, upper]) |
Deprecated. |
percentile_stairs ([lower, upper]) |
Calculates a percentile function (and returns a corresponding Stairs instance) |
plot ([ax]) |
Makes a step plot representing the finite intervals belonging to the Stairs instance. |
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. |
rolling_mean ([window, lower, upper]) |
Returns coordinates defining rolling mean |
sample (x[, how, aggfunc, window, lower_how, …]) |
Evaluates the value of the step function at one, or more, points. |
shift (delta) |
Returns a stairs instance corresponding to a horizontal translation by delta |
std ([lower, upper]) |
Calculates the standard deviation of the step function. |
step_changes () |
Returns a dictionary of key, value pairs of indicating where step changes occur in the step function, and the change in value |
subtract (other) |
An operator facilitating the subtraction of one step function from another. |
to_dataframe () |
Returns a pandas.DataFrame with columns ‘start’, ‘end’ and ‘value’ |
values_in_range ([lower, upper, lower_how, …]) |
Returns the range of the step function as a set of discrete values. |
var ([lower, upper]) |
Calculates the variance of the step function. |