staircase.StairsSlicer.mean¶
- StairsSlicer.mean()¶
Calculates the mean of each step function slice
- Returns
Examples
>>> df = sc.make_test_data(seed=0) >>> sf = sc.Stairs(df, "start", "end", "value") >>> sf.plot()
>>> sf.slice(pd.date_range("2021", periods=12, freq="MS")).mean() [2021-01-01, 2021-02-01) 436.869646 [2021-02-01, 2021-03-01) 374.335764 [2021-03-01, 2021-04-01) 501.771729 [2021-04-01, 2021-05-01) 502.593889 [2021-05-01, 2021-06-01) 396.009341 [2021-06-01, 2021-07-01) 398.588958 [2021-07-01, 2021-08-01) 488.410708 [2021-08-01, 2021-09-01) 475.959341 [2021-09-01, 2021-10-01) 438.847106 [2021-10-01, 2021-11-01) 463.746685 [2021-11-01, 2021-12-01) 474.082616 dtype: float64