lisa.datautils.series_window#

lisa.datautils.series_window(series, window, method='pre', clip_window=True)[source]#

Select a portion of a pandas.Series

Parameters:
  • series (pandas.Series) – series to slice

  • window (tuple(object)) – two-tuple of index values for the start and end of the region to select.

  • clip_window (bool) – Only True value is now allwed: clip the requested window to the bounds of the index, otherwise raise exceptions if the window is too large.

  • method

    Choose how edges are handled:

    • inclusive: When no exact match is found, include both the previous and next values around the window.

    • exclusive: When no exact match is found, only index values within the range are selected. This is the default pandas float slicing behavior.

    • nearest: Not supported with polars objects: when no exact match is found, take the nearest index value.

    • pre: When no exact match is found, take the previous index value.

    • post: When no exact match is found, take the next index value.

Note

The index of series must be monotonic and without duplicates.