I want to speed up my following code:
values_list = []
indices_list = []
offset_by_w = pd.tseries.frequencies.to_offset(135)
_ = signal[::-1].rolling(offset_by_w, min_periods=4, closed='both')./
apply(lambda x: [0, indices_list.append((x.index[-1], x.index[0])), values_list.append(x[::-1])][0], raw=True, engine='numba')
but I get an error:
numba.core.errors.TypingError: Failed in nopython mode pipeline (step: nopython frontend)
Failed in nopython mode pipeline (step: nopython frontend)
Failed in nopython mode pipeline (step: nopython frontend)
Untyped global name 'indices_list': Cannot type empty list
How can I solve this problem with saving values_list , indices_list ?
signal is pd.Series where indexies' type is Timestamp and values' type is float
I have pd.Series like this:
And I want to roll with moving window through the data (by reverse order) to get two lists with apply method:
where the 1st element looks like
the 2nd element looks like
where the 1st element looks like
the 2nd element looks like







I see you have the
pandarelleltag, to use it here you'd change your code to: