(rolling_func)
return impl
Generate series rolling methods implementations based on input func
Generate series rolling methods implementations based on input func
Generate series rolling methods implementations based on input func
def gen_hpat_pandas_series_rolling_impl(rolling_func):
    """Generate series rolling methods implementations based on input func"""
    def impl(self):
        win = self._window
        minp = self._min_periods

        input_series = self._data
        input_arr = input_series._data
        length = len(input_arr)
        output_arr = numpy.empty(length, dtype=float64)

        def apply_minp(arr, minp):
            finite_arr = arr[numpy.isfinite(arr)]
            if len(finite_arr) < minp:
                return numpy.nan
            else:
                return rolling_func(finite_arr)

        boundary = min(win, length)
        for i in prange(boundary):
            arr_range = input_arr[:i + 1]
            output_arr[i] = apply_minp(arr_range, minp)

        for i in prange(boundary, length):
            arr_range = input_arr[i + 1 - win:i + 1]
            output_arr[i] = apply_minp(arr_range, minp)

        return pandas.Series(output_arr, input_series._index, name=input_series._name)

    return impl
def gen_hpat_pandas_series_rolling_impl ( rolling_func ) : def impl ( self ) : win = self . _window minp = self . _min_periods input_series = self . _data input_arr = input_series . _data length = len ( input_arr ) output_arr = numpy . empty ( length , dtype = float64 ) def apply_minp ( arr , minp ) : finite_arr = arr [ numpy . isfinite ( arr ) ] if len ( finite_arr ) < minp : return numpy . nan else : return rolling_func ( finite_arr ) boundary = min ( win , length ) for i in prange ( boundary ) : arr_range = input_arr [ : i + 1 ] output_arr [ i ] = apply_minp ( arr_range , minp ) for i in prange ( boundary , length ) : arr_range = input_arr [ i + 1 - win : i + 1 ] output_arr [ i ] = apply_minp ( arr_range , minp ) return pandas . Series ( output_arr , input_series . _index , name = input_series . _name ) return impl