staircase.sample(collection, x)

Takes a dict-like collection of Stairs instances and evaluates their values across a common set of points.

Technically the results of this function should be considered as \(\lim_{x \to z^{-}} f(x)\) or \(\lim_{x \to z^{+}} f(x)\), when how = ‘left’ or how = ‘right’ respectively. See A note on interval endpoints for an explanation.

collectionarray-like, dictionary or pandas.Series

The Stairs instances at which to evaluate

xscalar or vector data

The points at which to sample the Stairs instances. Must belong to the step function domain.


A dataframe, where rows correspond to the Stairs instances in collection, and column correspond to the points in x. If collection is a dictionary then the resulting dataframe will be indexed by the dictionary keys. If collection is a pandas.Series then the dataframe will have the same index as the series.

See also



>>> stairs = [s2, s3]
>>> sc.sample(stairs, [2,3,4])
     2    3    4
0  0.0 -1.0 -1.0
1  0.0  NaN -1.0
>>> stairs = {"s2":s2, "s3":s3}
>>> sc.sample(stairs, [2,3,4])
      2    3    4
s1  0.0 -1.0 -1.0
s2  0.0  NaN -1.0
>>> index=pd.MultiIndex.from_tuples([("a", "s2"), ("b", "s3")])
>>> stairs = pd.Series([s2,s3], index=index)
>>> sc.sample(stairs, [2,3,4])
        2    3    4
a s1  0.0 -1.0 -1.0
b s2  0.0  NaN -1.0