piogrowth.durations module

piogrowth.durations module#

Operate on boolean series with a timestamp index.

piogrowth.durations.find_max_range(s: Series)[source]#

Find the maximum range of consecutive True values in a boolean Series.

Parameters:

s (pd.Series) – A boolean Series.

Returns:

A tuple containing the start and end indices of the maximum range of consecutive True values. If no True values are found, returns (pd.NaT, pd.NaT).

Return type:

tuple

piogrowth.durations.get_first_idxmax(s: Series)[source]#

Get idx max in Boolean Series

piogrowth.durations.get_last_true_index(s: Series)[source]#

Get the last index where the Series is True.

Parameters:

s (pd.Series) – A boolean Series.

Returns:

The last index where the Series is True, or pd.NaT if none exists.

Return type:

pd.Timestamp