def _apply(self, func, name=None, window=None, center=None,<EOL>check_minp=None, **kwargs):
if center is None:<EOL><INDENT>center = self.center<EOL><DEDENT>if window is None:<EOL><INDENT>window = self._get_window()<EOL><DEDENT>if check_minp is None:<EOL><INDENT>check_minp = _use_window<EOL><DEDENT>blocks, obj, index = self._create_blocks()<EOL>index, indexi = self._get_index(index=index)<EOL>results = []<EOL>for b in blocks:<EOL><INDENT>values = self._prep_values(b.values)<EOL>if values.size == <NUM_LIT:0>:<EOL><INDENT>results.append(values.copy())<EOL>continue<EOL><DEDENT>if isinstance(func, str):<EOL><INDENT>cfunc = getattr(libwindow, func, None)<EOL>if cfunc is None:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>".format(func=func))<EOL><DEDENT>def func(arg, window, min_periods=None, closed=None):<EOL><INDENT>minp = check_minp(min_periods, window)<EOL>arg = ensure_float64(arg)<EOL>return cfunc(arg,<EOL>window, minp, indexi, closed, **kwargs)<EOL><DEDENT><DEDENT>if center:<EOL><INDENT>offset = _offset(window, center)<EOL>additional_nans = np.array([np.NaN] * offset)<EOL>def calc(x):<EOL><INDENT>return func(np.concatenate((x, additional_nans)),<EOL>window, min_periods=self.min_periods,<EOL>closed=self.closed)<EOL><DEDENT><DEDENT>else:<EOL><INDENT>def calc(x):<EOL><INDENT>return func(x, window, min_periods=self.min_periods,<EOL>closed=self.closed)<EOL><DEDENT><DEDENT>with np.errstate(all='<STR_LIT:ignore>'):<EOL><INDENT>if values.ndim > <NUM_LIT:1>:<EOL><INDENT>result = np.apply_along_axis(calc, self.axis, values)<EOL><DEDENT>else:<EOL><INDENT>result = calc(values)<EOL><DEDENT><DEDENT>if center:<EOL><INDENT>result = self._center_window(result, window)<EOL><DEDENT>results.append(result)<EOL><DEDENT>return self._wrap_results(results, blocks, obj)<EOL>
Rolling statistical measure using supplied function.

Designed to be used with passed-in Cython array-based functions.

Parameters
----------
func : str/callable to apply
name : str, optional
   name of this function
window : int/array, default to _get_window()
center : bool, default to self.center
check_minp : function, default to _use_window

Returns
-------
y : type of input