diff --git a/doc/source/whatsnew/v2.0.0.rst b/doc/source/whatsnew/v2.0.0.rst index cbad169fe4d56..a98d04b967428 100644 --- a/doc/source/whatsnew/v2.0.0.rst +++ b/doc/source/whatsnew/v2.0.0.rst @@ -719,6 +719,7 @@ Removal of prior version deprecations/changes - When providing a list of columns of length one to :meth:`DataFrame.groupby`, the keys that are returned by iterating over the resulting :class:`DataFrameGroupBy` object will now be tuples of length one (:issue:`47761`) - Removed deprecated methods :meth:`ExcelWriter.write_cells`, :meth:`ExcelWriter.save`, :meth:`ExcelWriter.cur_sheet`, :meth:`ExcelWriter.handles`, :meth:`ExcelWriter.path` (:issue:`45795`) - The :class:`ExcelWriter` attribute ``book`` can no longer be set; it is still available to be accessed and mutated (:issue:`48943`) +- Removed unused ``*args`` and ``**kwargs`` in :class:`Rolling`, :class:`Expanding`, and :class:`ExponentialMovingWindow` ops (:issue:`47851`) - .. --------------------------------------------------------------------------- diff --git a/pandas/compat/numpy/function.py b/pandas/compat/numpy/function.py index b02dfac1400d1..f2bfde585fbeb 100644 --- a/pandas/compat/numpy/function.py +++ b/pandas/compat/numpy/function.py @@ -335,51 +335,6 @@ def validate_take_with_convert(convert: ndarray | bool | None, args, kwargs) -> ) -def validate_window_func(name, args, kwargs) -> None: - numpy_args = ("axis", "dtype", "out") - msg = ( - f"numpy operations are not valid with window objects. " - f"Use .{name}() directly instead " - ) - - if len(args) > 0: - raise UnsupportedFunctionCall(msg) - - for arg in numpy_args: - if arg in kwargs: - raise UnsupportedFunctionCall(msg) - - -def validate_rolling_func(name, args, kwargs) -> None: - numpy_args = ("axis", "dtype", "out") - msg = ( - f"numpy operations are not valid with window objects. " - f"Use .rolling(...).{name}() instead " - ) - - if len(args) > 0: - raise UnsupportedFunctionCall(msg) - - for arg in numpy_args: - if arg in kwargs: - raise UnsupportedFunctionCall(msg) - - -def validate_expanding_func(name, args, kwargs) -> None: - numpy_args = ("axis", "dtype", "out") - msg = ( - f"numpy operations are not valid with window objects. " - f"Use .expanding(...).{name}() instead " - ) - - if len(args) > 0: - raise UnsupportedFunctionCall(msg) - - for arg in numpy_args: - if arg in kwargs: - raise UnsupportedFunctionCall(msg) - - def validate_groupby_func(name, args, kwargs, allowed=None) -> None: """ 'args' and 'kwargs' should be empty, except for allowed kwargs because all diff --git a/pandas/core/window/common.py b/pandas/core/window/common.py index ddcd114aa352b..ff1c3c1784bd6 100644 --- a/pandas/core/window/common.py +++ b/pandas/core/window/common.py @@ -3,12 +3,9 @@ from collections import defaultdict from typing import cast -import warnings import numpy as np -from pandas.util._exceptions import find_stack_level - from pandas.core.dtypes.generic import ( ABCDataFrame, ABCSeries, @@ -172,38 +169,3 @@ def prep_binary(arg1, arg2): X = arg1 + 0 * arg2 Y = arg2 + 0 * arg1 return X, Y - - -def maybe_warn_args_and_kwargs(cls, kernel: str, args, kwargs) -> None: - """ - Warn for deprecation of args and kwargs in rolling/expanding functions. - - Parameters - ---------- - cls : type - Class to warn about. - kernel : str - Operation name. - args : tuple or None - args passed by user. Will be None if and only if kernel does not have args. - kwargs : dict or None - kwargs passed by user. Will be None if and only if kernel does not have kwargs. - """ - warn_args = args is not None and len(args) > 0 - warn_kwargs = kwargs is not None and len(kwargs) > 0 - if warn_args and warn_kwargs: - msg = "args and kwargs" - elif warn_args: - msg = "args" - elif warn_kwargs: - msg = "kwargs" - else: - msg = "" - if msg != "": - warnings.warn( - f"Passing additional {msg} to {cls.__name__}.{kernel} has " - "no impact on the result and is deprecated. This will " - "raise a TypeError in a future version of pandas.", - category=FutureWarning, - stacklevel=find_stack_level(), - ) diff --git a/pandas/core/window/doc.py b/pandas/core/window/doc.py index 950bc047a692a..b1ff53e9d1a44 100644 --- a/pandas/core/window/doc.py +++ b/pandas/core/window/doc.py @@ -40,24 +40,6 @@ def create_section_header(header: str) -> str: """ ).replace("\n", "", 1) -args_compat = dedent( - """ - *args - For NumPy compatibility and will not have an effect on the result. - - .. deprecated:: 1.5.0\n - """ -).replace("\n", "", 1) - -kwargs_compat = dedent( - """ - **kwargs - For NumPy compatibility and will not have an effect on the result. - - .. deprecated:: 1.5.0\n - """ -).replace("\n", "", 1) - kwargs_scipy = dedent( """ **kwargs diff --git a/pandas/core/window/ewm.py b/pandas/core/window/ewm.py index b53e9fc3c55ec..a6c32133803d4 100644 --- a/pandas/core/window/ewm.py +++ b/pandas/core/window/ewm.py @@ -18,7 +18,6 @@ from pandas import DataFrame, Series from pandas.core.generic import NDFrame -from pandas.compat.numpy import function as nv from pandas.util._decorators import doc from pandas.core.dtypes.common import ( @@ -37,15 +36,10 @@ get_jit_arguments, maybe_use_numba, ) -from pandas.core.window.common import ( - maybe_warn_args_and_kwargs, - zsqrt, -) +from pandas.core.window.common import zsqrt from pandas.core.window.doc import ( _shared_docs, - args_compat, create_section_header, - kwargs_compat, kwargs_numeric_only, numba_notes, template_header, @@ -503,9 +497,7 @@ def aggregate(self, func, *args, **kwargs): template_header, create_section_header("Parameters"), kwargs_numeric_only, - args_compat, window_agg_numba_parameters(), - kwargs_compat, create_section_header("Returns"), template_returns, create_section_header("See Also"), @@ -519,12 +511,9 @@ def aggregate(self, func, *args, **kwargs): def mean( self, numeric_only: bool = False, - *args, engine=None, engine_kwargs=None, - **kwargs, ): - maybe_warn_args_and_kwargs(type(self), "mean", args, kwargs) if maybe_use_numba(engine): if self.method == "single": func = generate_numba_ewm_func @@ -542,7 +531,6 @@ def mean( elif engine in ("cython", None): if engine_kwargs is not None: raise ValueError("cython engine does not accept engine_kwargs") - nv.validate_window_func("mean", args, kwargs) deltas = None if self.times is None else self._deltas window_func = partial( @@ -561,9 +549,7 @@ def mean( template_header, create_section_header("Parameters"), kwargs_numeric_only, - args_compat, window_agg_numba_parameters(), - kwargs_compat, create_section_header("Returns"), template_returns, create_section_header("See Also"), @@ -577,12 +563,9 @@ def mean( def sum( self, numeric_only: bool = False, - *args, engine=None, engine_kwargs=None, - **kwargs, ): - maybe_warn_args_and_kwargs(type(self), "sum", args, kwargs) if not self.adjust: raise NotImplementedError("sum is not implemented with adjust=False") if maybe_use_numba(engine): @@ -602,7 +585,6 @@ def sum( elif engine in ("cython", None): if engine_kwargs is not None: raise ValueError("cython engine does not accept engine_kwargs") - nv.validate_window_func("sum", args, kwargs) deltas = None if self.times is None else self._deltas window_func = partial( @@ -627,8 +609,6 @@ def sum( """ ).replace("\n", "", 1), kwargs_numeric_only, - args_compat, - kwargs_compat, create_section_header("Returns"), template_returns, create_section_header("See Also"), @@ -637,9 +617,7 @@ def sum( aggregation_description="(exponential weighted moment) standard deviation", agg_method="std", ) - def std(self, bias: bool = False, numeric_only: bool = False, *args, **kwargs): - maybe_warn_args_and_kwargs(type(self), "std", args, kwargs) - nv.validate_window_func("std", args, kwargs) + def std(self, bias: bool = False, numeric_only: bool = False): if ( numeric_only and self._selected_obj.ndim == 1 @@ -649,7 +627,7 @@ def std(self, bias: bool = False, numeric_only: bool = False, *args, **kwargs): raise NotImplementedError( f"{type(self).__name__}.std does not implement numeric_only" ) - return zsqrt(self.var(bias=bias, numeric_only=numeric_only, **kwargs)) + return zsqrt(self.var(bias=bias, numeric_only=numeric_only)) @doc( template_header, @@ -661,8 +639,6 @@ def std(self, bias: bool = False, numeric_only: bool = False, *args, **kwargs): """ ).replace("\n", "", 1), kwargs_numeric_only, - args_compat, - kwargs_compat, create_section_header("Returns"), template_returns, create_section_header("See Also"), @@ -671,9 +647,7 @@ def std(self, bias: bool = False, numeric_only: bool = False, *args, **kwargs): aggregation_description="(exponential weighted moment) variance", agg_method="var", ) - def var(self, bias: bool = False, numeric_only: bool = False, *args, **kwargs): - maybe_warn_args_and_kwargs(type(self), "var", args, kwargs) - nv.validate_window_func("var", args, kwargs) + def var(self, bias: bool = False, numeric_only: bool = False): window_func = window_aggregations.ewmcov wfunc = partial( window_func, @@ -708,7 +682,6 @@ def var_func(values, begin, end, min_periods): """ ).replace("\n", "", 1), kwargs_numeric_only, - kwargs_compat, create_section_header("Returns"), template_returns, create_section_header("See Also"), @@ -723,11 +696,9 @@ def cov( pairwise: bool | None = None, bias: bool = False, numeric_only: bool = False, - **kwargs, ): from pandas import Series - maybe_warn_args_and_kwargs(type(self), "cov", None, kwargs) self._validate_numeric_only("cov", numeric_only) def cov_func(x, y): @@ -783,7 +754,6 @@ def cov_func(x, y): """ ).replace("\n", "", 1), kwargs_numeric_only, - kwargs_compat, create_section_header("Returns"), template_returns, create_section_header("See Also"), @@ -797,11 +767,9 @@ def corr( other: DataFrame | Series | None = None, pairwise: bool | None = None, numeric_only: bool = False, - **kwargs, ): from pandas import Series - maybe_warn_args_and_kwargs(type(self), "corr", None, kwargs) self._validate_numeric_only("corr", numeric_only) def cov_func(x, y): @@ -940,7 +908,6 @@ def corr( other: DataFrame | Series | None = None, pairwise: bool | None = None, numeric_only: bool = False, - **kwargs, ): raise NotImplementedError("corr is not implemented.") @@ -950,11 +917,10 @@ def cov( pairwise: bool | None = None, bias: bool = False, numeric_only: bool = False, - **kwargs, ): raise NotImplementedError("cov is not implemented.") - def var(self, bias: bool = False, *args, **kwargs): + def var(self, bias: bool = False, numeric_only: bool = False): raise NotImplementedError("var is not implemented.") def mean(self, *args, update=None, update_times=None, **kwargs): diff --git a/pandas/core/window/expanding.py b/pandas/core/window/expanding.py index 621f1ae18080d..6147f0f43c558 100644 --- a/pandas/core/window/expanding.py +++ b/pandas/core/window/expanding.py @@ -17,7 +17,6 @@ from pandas import DataFrame, Series from pandas.core.generic import NDFrame -from pandas.compat.numpy import function as nv from pandas.util._decorators import doc from pandas.core.indexers.objects import ( @@ -25,12 +24,9 @@ ExpandingIndexer, GroupbyIndexer, ) -from pandas.core.window.common import maybe_warn_args_and_kwargs from pandas.core.window.doc import ( _shared_docs, - args_compat, create_section_header, - kwargs_compat, kwargs_numeric_only, numba_notes, template_header, @@ -223,9 +219,7 @@ def apply( template_header, create_section_header("Parameters"), kwargs_numeric_only, - args_compat, window_agg_numba_parameters(), - kwargs_compat, create_section_header("Returns"), template_returns, create_section_header("See Also"), @@ -239,27 +233,20 @@ def apply( def sum( self, numeric_only: bool = False, - *args, engine: str | None = None, engine_kwargs: dict[str, bool] | None = None, - **kwargs, ): - maybe_warn_args_and_kwargs(type(self), "sum", args, kwargs) - nv.validate_expanding_func("sum", args, kwargs) return super().sum( numeric_only=numeric_only, engine=engine, engine_kwargs=engine_kwargs, - **kwargs, ) @doc( template_header, create_section_header("Parameters"), kwargs_numeric_only, - args_compat, window_agg_numba_parameters(), - kwargs_compat, create_section_header("Returns"), template_returns, create_section_header("See Also"), @@ -273,27 +260,20 @@ def sum( def max( self, numeric_only: bool = False, - *args, engine: str | None = None, engine_kwargs: dict[str, bool] | None = None, - **kwargs, ): - maybe_warn_args_and_kwargs(type(self), "max", args, kwargs) - nv.validate_expanding_func("max", args, kwargs) return super().max( numeric_only=numeric_only, engine=engine, engine_kwargs=engine_kwargs, - **kwargs, ) @doc( template_header, create_section_header("Parameters"), kwargs_numeric_only, - args_compat, window_agg_numba_parameters(), - kwargs_compat, create_section_header("Returns"), template_returns, create_section_header("See Also"), @@ -307,27 +287,20 @@ def max( def min( self, numeric_only: bool = False, - *args, engine: str | None = None, engine_kwargs: dict[str, bool] | None = None, - **kwargs, ): - maybe_warn_args_and_kwargs(type(self), "min", args, kwargs) - nv.validate_expanding_func("min", args, kwargs) return super().min( numeric_only=numeric_only, engine=engine, engine_kwargs=engine_kwargs, - **kwargs, ) @doc( template_header, create_section_header("Parameters"), kwargs_numeric_only, - args_compat, window_agg_numba_parameters(), - kwargs_compat, create_section_header("Returns"), template_returns, create_section_header("See Also"), @@ -341,18 +314,13 @@ def min( def mean( self, numeric_only: bool = False, - *args, engine: str | None = None, engine_kwargs: dict[str, bool] | None = None, - **kwargs, ): - maybe_warn_args_and_kwargs(type(self), "mean", args, kwargs) - nv.validate_expanding_func("mean", args, kwargs) return super().mean( numeric_only=numeric_only, engine=engine, engine_kwargs=engine_kwargs, - **kwargs, ) @doc( @@ -360,7 +328,6 @@ def mean( create_section_header("Parameters"), kwargs_numeric_only, window_agg_numba_parameters(), - kwargs_compat, create_section_header("Returns"), template_returns, create_section_header("See Also"), @@ -376,14 +343,11 @@ def median( numeric_only: bool = False, engine: str | None = None, engine_kwargs: dict[str, bool] | None = None, - **kwargs, ): - maybe_warn_args_and_kwargs(type(self), "median", None, kwargs) return super().median( numeric_only=numeric_only, engine=engine, engine_kwargs=engine_kwargs, - **kwargs, ) @doc( @@ -397,9 +361,7 @@ def median( """ ).replace("\n", "", 1), kwargs_numeric_only, - args_compat, window_agg_numba_parameters("1.4"), - kwargs_compat, create_section_header("Returns"), template_returns, create_section_header("See Also"), @@ -438,19 +400,14 @@ def std( self, ddof: int = 1, numeric_only: bool = False, - *args, engine: str | None = None, engine_kwargs: dict[str, bool] | None = None, - **kwargs, ): - maybe_warn_args_and_kwargs(type(self), "std", args, kwargs) - nv.validate_expanding_func("std", args, kwargs) return super().std( ddof=ddof, numeric_only=numeric_only, engine=engine, engine_kwargs=engine_kwargs, - **kwargs, ) @doc( @@ -464,9 +421,7 @@ def std( """ ).replace("\n", "", 1), kwargs_numeric_only, - args_compat, window_agg_numba_parameters("1.4"), - kwargs_compat, create_section_header("Returns"), template_returns, create_section_header("See Also"), @@ -505,19 +460,14 @@ def var( self, ddof: int = 1, numeric_only: bool = False, - *args, engine: str | None = None, engine_kwargs: dict[str, bool] | None = None, - **kwargs, ): - maybe_warn_args_and_kwargs(type(self), "var", args, kwargs) - nv.validate_expanding_func("var", args, kwargs) return super().var( ddof=ddof, numeric_only=numeric_only, engine=engine, engine_kwargs=engine_kwargs, - **kwargs, ) @doc( @@ -531,8 +481,6 @@ def var( """ ).replace("\n", "", 1), kwargs_numeric_only, - args_compat, - kwargs_compat, create_section_header("Returns"), template_returns, create_section_header("See Also"), @@ -556,15 +504,13 @@ def var( aggregation_description="standard error of mean", agg_method="sem", ) - def sem(self, ddof: int = 1, numeric_only: bool = False, *args, **kwargs): - maybe_warn_args_and_kwargs(type(self), "sem", args, kwargs) - return super().sem(ddof=ddof, numeric_only=numeric_only, **kwargs) + def sem(self, ddof: int = 1, numeric_only: bool = False): + return super().sem(ddof=ddof, numeric_only=numeric_only) @doc( template_header, create_section_header("Parameters"), kwargs_numeric_only, - kwargs_compat, create_section_header("Returns"), template_returns, create_section_header("See Also"), @@ -576,15 +522,13 @@ def sem(self, ddof: int = 1, numeric_only: bool = False, *args, **kwargs): aggregation_description="unbiased skewness", agg_method="skew", ) - def skew(self, numeric_only: bool = False, **kwargs): - maybe_warn_args_and_kwargs(type(self), "skew", None, kwargs) - return super().skew(numeric_only=numeric_only, **kwargs) + def skew(self, numeric_only: bool = False): + return super().skew(numeric_only=numeric_only) @doc( template_header, create_section_header("Parameters"), kwargs_numeric_only, - kwargs_compat, create_section_header("Returns"), template_returns, create_section_header("See Also"), @@ -618,9 +562,8 @@ def skew(self, numeric_only: bool = False, **kwargs): aggregation_description="Fisher's definition of kurtosis without bias", agg_method="kurt", ) - def kurt(self, numeric_only: bool = False, **kwargs): - maybe_warn_args_and_kwargs(type(self), "kurt", None, kwargs) - return super().kurt(numeric_only=numeric_only, **kwargs) + def kurt(self, numeric_only: bool = False): + return super().kurt(numeric_only=numeric_only) @doc( template_header, @@ -642,7 +585,6 @@ def kurt(self, numeric_only: bool = False, **kwargs): """ ).replace("\n", "", 1), kwargs_numeric_only, - kwargs_compat, create_section_header("Returns"), template_returns, create_section_header("See Also"), @@ -656,14 +598,11 @@ def quantile( quantile: float, interpolation: QuantileInterpolation = "linear", numeric_only: bool = False, - **kwargs, ): - maybe_warn_args_and_kwargs(type(self), "quantile", None, kwargs) return super().quantile( quantile=quantile, interpolation=interpolation, numeric_only=numeric_only, - **kwargs, ) @doc( @@ -687,7 +626,6 @@ def quantile( """ ).replace("\n", "", 1), kwargs_numeric_only, - kwargs_compat, create_section_header("Returns"), template_returns, create_section_header("See Also"), @@ -734,15 +672,12 @@ def rank( ascending: bool = True, pct: bool = False, numeric_only: bool = False, - **kwargs, ): - maybe_warn_args_and_kwargs(type(self), "rank", None, kwargs) return super().rank( method=method, ascending=ascending, pct=pct, numeric_only=numeric_only, - **kwargs, ) @doc( @@ -766,7 +701,6 @@ def rank( """ ).replace("\n", "", 1), kwargs_numeric_only, - kwargs_compat, create_section_header("Returns"), template_returns, create_section_header("See Also"), @@ -781,15 +715,12 @@ def cov( pairwise: bool | None = None, ddof: int = 1, numeric_only: bool = False, - **kwargs, ): - maybe_warn_args_and_kwargs(type(self), "cov", None, kwargs) return super().cov( other=other, pairwise=pairwise, ddof=ddof, numeric_only=numeric_only, - **kwargs, ) @doc( @@ -810,7 +741,6 @@ def cov( """ ).replace("\n", "", 1), kwargs_numeric_only, - kwargs_compat, create_section_header("Returns"), template_returns, create_section_header("See Also"), @@ -855,15 +785,12 @@ def corr( pairwise: bool | None = None, ddof: int = 1, numeric_only: bool = False, - **kwargs, ): - maybe_warn_args_and_kwargs(type(self), "corr", None, kwargs) return super().corr( other=other, pairwise=pairwise, ddof=ddof, numeric_only=numeric_only, - **kwargs, ) diff --git a/pandas/core/window/rolling.py b/pandas/core/window/rolling.py index 359682af46c07..989b82f45339f 100644 --- a/pandas/core/window/rolling.py +++ b/pandas/core/window/rolling.py @@ -35,7 +35,6 @@ WindowingRankType, ) from pandas.compat._optional import import_optional_dependency -from pandas.compat.numpy import function as nv from pandas.errors import DataError from pandas.util._decorators import doc from pandas.util._exceptions import find_stack_level @@ -81,14 +80,11 @@ ) from pandas.core.window.common import ( flex_binary_moment, - maybe_warn_args_and_kwargs, zsqrt, ) from pandas.core.window.doc import ( _shared_docs, - args_compat, create_section_header, - kwargs_compat, kwargs_numeric_only, kwargs_scipy, numba_notes, @@ -1289,8 +1285,7 @@ def aggregate(self, func, *args, **kwargs): aggregation_description="weighted window sum", agg_method="sum", ) - def sum(self, numeric_only: bool = False, *args, **kwargs): - nv.validate_window_func("sum", args, kwargs) + def sum(self, numeric_only: bool = False, **kwargs): window_func = window_aggregations.roll_weighted_sum # error: Argument 1 to "_apply" of "Window" has incompatible type # "Callable[[ndarray, ndarray, int], ndarray]"; expected @@ -1315,8 +1310,7 @@ def sum(self, numeric_only: bool = False, *args, **kwargs): aggregation_description="weighted window mean", agg_method="mean", ) - def mean(self, numeric_only: bool = False, *args, **kwargs): - nv.validate_window_func("mean", args, kwargs) + def mean(self, numeric_only: bool = False, **kwargs): window_func = window_aggregations.roll_weighted_mean # error: Argument 1 to "_apply" of "Window" has incompatible type # "Callable[[ndarray, ndarray, int], ndarray]"; expected @@ -1342,8 +1336,7 @@ def mean(self, numeric_only: bool = False, *args, **kwargs): aggregation_description="weighted window variance", agg_method="var", ) - def var(self, ddof: int = 1, numeric_only: bool = False, *args, **kwargs): - nv.validate_window_func("var", args, kwargs) + def var(self, ddof: int = 1, numeric_only: bool = False, **kwargs): window_func = partial(window_aggregations.roll_weighted_var, ddof=ddof) kwargs.pop("name", None) return self._apply(window_func, name="var", numeric_only=numeric_only, **kwargs) @@ -1362,8 +1355,7 @@ def var(self, ddof: int = 1, numeric_only: bool = False, *args, **kwargs): aggregation_description="weighted window standard deviation", agg_method="std", ) - def std(self, ddof: int = 1, numeric_only: bool = False, *args, **kwargs): - nv.validate_window_func("std", args, kwargs) + def std(self, ddof: int = 1, numeric_only: bool = False, **kwargs): return zsqrt( self.var(ddof=ddof, name="std", numeric_only=numeric_only, **kwargs) ) @@ -1445,12 +1437,9 @@ def apply_func(values, begin, end, min_periods, raw=raw): def sum( self, numeric_only: bool = False, - *args, engine: str | None = None, engine_kwargs: dict[str, bool] | None = None, - **kwargs, ): - nv.validate_window_func("sum", args, kwargs) if maybe_use_numba(engine): if self.method == "table": func = generate_manual_numpy_nan_agg_with_axis(np.nansum) @@ -1465,17 +1454,14 @@ def sum( return self._numba_apply(sliding_sum, engine_kwargs) window_func = window_aggregations.roll_sum - return self._apply(window_func, name="sum", numeric_only=numeric_only, **kwargs) + return self._apply(window_func, name="sum", numeric_only=numeric_only) def max( self, numeric_only: bool = False, - *args, engine: str | None = None, engine_kwargs: dict[str, bool] | None = None, - **kwargs, ): - nv.validate_window_func("max", args, kwargs) if maybe_use_numba(engine): if self.method == "table": func = generate_manual_numpy_nan_agg_with_axis(np.nanmax) @@ -1490,17 +1476,14 @@ def max( return self._numba_apply(sliding_min_max, engine_kwargs, True) window_func = window_aggregations.roll_max - return self._apply(window_func, name="max", numeric_only=numeric_only, **kwargs) + return self._apply(window_func, name="max", numeric_only=numeric_only) def min( self, numeric_only: bool = False, - *args, engine: str | None = None, engine_kwargs: dict[str, bool] | None = None, - **kwargs, ): - nv.validate_window_func("min", args, kwargs) if maybe_use_numba(engine): if self.method == "table": func = generate_manual_numpy_nan_agg_with_axis(np.nanmin) @@ -1515,17 +1498,14 @@ def min( return self._numba_apply(sliding_min_max, engine_kwargs, False) window_func = window_aggregations.roll_min - return self._apply(window_func, name="min", numeric_only=numeric_only, **kwargs) + return self._apply(window_func, name="min", numeric_only=numeric_only) def mean( self, numeric_only: bool = False, - *args, engine: str | None = None, engine_kwargs: dict[str, bool] | None = None, - **kwargs, ): - nv.validate_window_func("mean", args, kwargs) if maybe_use_numba(engine): if self.method == "table": func = generate_manual_numpy_nan_agg_with_axis(np.nanmean) @@ -1540,16 +1520,13 @@ def mean( return self._numba_apply(sliding_mean, engine_kwargs) window_func = window_aggregations.roll_mean - return self._apply( - window_func, name="mean", numeric_only=numeric_only, **kwargs - ) + return self._apply(window_func, name="mean", numeric_only=numeric_only) def median( self, numeric_only: bool = False, engine: str | None = None, engine_kwargs: dict[str, bool] | None = None, - **kwargs, ): if maybe_use_numba(engine): if self.method == "table": @@ -1564,20 +1541,15 @@ def median( engine_kwargs=engine_kwargs, ) window_func = window_aggregations.roll_median_c - return self._apply( - window_func, name="median", numeric_only=numeric_only, **kwargs - ) + return self._apply(window_func, name="median", numeric_only=numeric_only) def std( self, ddof: int = 1, numeric_only: bool = False, - *args, engine: str | None = None, engine_kwargs: dict[str, bool] | None = None, - **kwargs, ): - nv.validate_window_func("std", args, kwargs) if maybe_use_numba(engine): if self.method == "table": raise NotImplementedError("std not supported with method='table'") @@ -1593,19 +1565,15 @@ def zsqrt_func(values, begin, end, min_periods): zsqrt_func, name="std", numeric_only=numeric_only, - **kwargs, ) def var( self, ddof: int = 1, numeric_only: bool = False, - *args, engine: str | None = None, engine_kwargs: dict[str, bool] | None = None, - **kwargs, ): - nv.validate_window_func("var", args, kwargs) if maybe_use_numba(engine): if self.method == "table": raise NotImplementedError("var not supported with method='table'") @@ -1617,33 +1585,29 @@ def var( window_func, name="var", numeric_only=numeric_only, - **kwargs, ) - def skew(self, numeric_only: bool = False, **kwargs): + def skew(self, numeric_only: bool = False): window_func = window_aggregations.roll_skew return self._apply( window_func, name="skew", numeric_only=numeric_only, - **kwargs, ) - def sem(self, ddof: int = 1, numeric_only: bool = False, *args, **kwargs): - nv.validate_rolling_func("sem", args, kwargs) + def sem(self, ddof: int = 1, numeric_only: bool = False): # Raise here so error message says sem instead of std self._validate_numeric_only("sem", numeric_only) - return self.std(numeric_only=numeric_only, **kwargs) / ( + return self.std(numeric_only=numeric_only) / ( self.count(numeric_only=numeric_only) - ddof ).pow(0.5) - def kurt(self, numeric_only: bool = False, **kwargs): + def kurt(self, numeric_only: bool = False): window_func = window_aggregations.roll_kurt return self._apply( window_func, name="kurt", numeric_only=numeric_only, - **kwargs, ) def quantile( @@ -1651,7 +1615,6 @@ def quantile( quantile: float, interpolation: QuantileInterpolation = "linear", numeric_only: bool = False, - **kwargs, ): if quantile == 1.0: window_func = window_aggregations.roll_max @@ -1664,9 +1627,7 @@ def quantile( interpolation=interpolation, ) - return self._apply( - window_func, name="quantile", numeric_only=numeric_only, **kwargs - ) + return self._apply(window_func, name="quantile", numeric_only=numeric_only) def rank( self, @@ -1674,7 +1635,6 @@ def rank( ascending: bool = True, pct: bool = False, numeric_only: bool = False, - **kwargs, ): window_func = partial( window_aggregations.roll_rank, @@ -1683,9 +1643,7 @@ def rank( percentile=pct, ) - return self._apply( - window_func, name="rank", numeric_only=numeric_only, **kwargs - ) + return self._apply(window_func, name="rank", numeric_only=numeric_only) def cov( self, @@ -1693,7 +1651,6 @@ def cov( pairwise: bool | None = None, ddof: int = 1, numeric_only: bool = False, - **kwargs, ): if self.step is not None: raise NotImplementedError("step not implemented for cov") @@ -1741,7 +1698,6 @@ def corr( pairwise: bool | None = None, ddof: int = 1, numeric_only: bool = False, - **kwargs, ): if self.step is not None: raise NotImplementedError("step not implemented for corr") @@ -1985,9 +1941,7 @@ def apply( template_header, create_section_header("Parameters"), kwargs_numeric_only, - args_compat, window_agg_numba_parameters(), - kwargs_compat, create_section_header("Returns"), template_returns, create_section_header("See Also"), @@ -2049,27 +2003,20 @@ def apply( def sum( self, numeric_only: bool = False, - *args, engine: str | None = None, engine_kwargs: dict[str, bool] | None = None, - **kwargs, ): - maybe_warn_args_and_kwargs(type(self), "sum", args, kwargs) - nv.validate_rolling_func("sum", args, kwargs) return super().sum( numeric_only=numeric_only, engine=engine, engine_kwargs=engine_kwargs, - **kwargs, ) @doc( template_header, create_section_header("Parameters"), kwargs_numeric_only, - args_compat, window_agg_numba_parameters(), - kwargs_compat, create_section_header("Returns"), template_returns, create_section_header("See Also"), @@ -2088,22 +2035,17 @@ def max( engine_kwargs: dict[str, bool] | None = None, **kwargs, ): - maybe_warn_args_and_kwargs(type(self), "max", args, kwargs) - nv.validate_rolling_func("max", args, kwargs) return super().max( numeric_only=numeric_only, engine=engine, engine_kwargs=engine_kwargs, - **kwargs, ) @doc( template_header, create_section_header("Parameters"), kwargs_numeric_only, - args_compat, window_agg_numba_parameters(), - kwargs_compat, create_section_header("Returns"), template_returns, create_section_header("See Also"), @@ -2132,27 +2074,20 @@ def max( def min( self, numeric_only: bool = False, - *args, engine: str | None = None, engine_kwargs: dict[str, bool] | None = None, - **kwargs, ): - maybe_warn_args_and_kwargs(type(self), "min", args, kwargs) - nv.validate_rolling_func("min", args, kwargs) return super().min( numeric_only=numeric_only, engine=engine, engine_kwargs=engine_kwargs, - **kwargs, ) @doc( template_header, create_section_header("Parameters"), kwargs_numeric_only, - args_compat, window_agg_numba_parameters(), - kwargs_compat, create_section_header("Returns"), template_returns, create_section_header("See Also"), @@ -2188,18 +2123,13 @@ def min( def mean( self, numeric_only: bool = False, - *args, engine: str | None = None, engine_kwargs: dict[str, bool] | None = None, - **kwargs, ): - maybe_warn_args_and_kwargs(type(self), "mean", args, kwargs) - nv.validate_rolling_func("mean", args, kwargs) return super().mean( numeric_only=numeric_only, engine=engine, engine_kwargs=engine_kwargs, - **kwargs, ) @doc( @@ -2207,7 +2137,6 @@ def mean( create_section_header("Parameters"), kwargs_numeric_only, window_agg_numba_parameters(), - kwargs_compat, create_section_header("Returns"), template_returns, create_section_header("See Also"), @@ -2238,14 +2167,11 @@ def median( numeric_only: bool = False, engine: str | None = None, engine_kwargs: dict[str, bool] | None = None, - **kwargs, ): - maybe_warn_args_and_kwargs(type(self), "median", None, kwargs) return super().median( numeric_only=numeric_only, engine=engine, engine_kwargs=engine_kwargs, - **kwargs, ) @doc( @@ -2259,9 +2185,7 @@ def median( """ ).replace("\n", "", 1), kwargs_numeric_only, - args_compat, window_agg_numba_parameters("1.4"), - kwargs_compat, create_section_header("Returns"), template_returns, create_section_header("See Also"), @@ -2299,19 +2223,14 @@ def std( self, ddof: int = 1, numeric_only: bool = False, - *args, engine: str | None = None, engine_kwargs: dict[str, bool] | None = None, - **kwargs, ): - maybe_warn_args_and_kwargs(type(self), "std", args, kwargs) - nv.validate_rolling_func("std", args, kwargs) return super().std( ddof=ddof, numeric_only=numeric_only, engine=engine, engine_kwargs=engine_kwargs, - **kwargs, ) @doc( @@ -2325,9 +2244,7 @@ def std( """ ).replace("\n", "", 1), kwargs_numeric_only, - args_compat, window_agg_numba_parameters("1.4"), - kwargs_compat, create_section_header("Returns"), template_returns, create_section_header("See Also"), @@ -2365,26 +2282,20 @@ def var( self, ddof: int = 1, numeric_only: bool = False, - *args, engine: str | None = None, engine_kwargs: dict[str, bool] | None = None, - **kwargs, ): - maybe_warn_args_and_kwargs(type(self), "var", args, kwargs) - nv.validate_rolling_func("var", args, kwargs) return super().var( ddof=ddof, numeric_only=numeric_only, engine=engine, engine_kwargs=engine_kwargs, - **kwargs, ) @doc( template_header, create_section_header("Parameters"), kwargs_numeric_only, - kwargs_compat, create_section_header("Returns"), template_returns, create_section_header("See Also"), @@ -2396,9 +2307,8 @@ def var( aggregation_description="unbiased skewness", agg_method="skew", ) - def skew(self, numeric_only: bool = False, **kwargs): - maybe_warn_args_and_kwargs(type(self), "skew", None, kwargs) - return super().skew(numeric_only=numeric_only, **kwargs) + def skew(self, numeric_only: bool = False): + return super().skew(numeric_only=numeric_only) @doc( template_header, @@ -2411,8 +2321,6 @@ def skew(self, numeric_only: bool = False, **kwargs): """ ).replace("\n", "", 1), kwargs_numeric_only, - args_compat, - kwargs_compat, create_section_header("Returns"), template_returns, create_section_header("See Also"), @@ -2435,12 +2343,10 @@ def skew(self, numeric_only: bool = False, **kwargs): aggregation_description="standard error of mean", agg_method="sem", ) - def sem(self, ddof: int = 1, numeric_only: bool = False, *args, **kwargs): - maybe_warn_args_and_kwargs(type(self), "sem", args, kwargs) - nv.validate_rolling_func("sem", args, kwargs) + def sem(self, ddof: int = 1, numeric_only: bool = False): # Raise here so error message says sem instead of std self._validate_numeric_only("sem", numeric_only) - return self.std(numeric_only=numeric_only, **kwargs) / ( + return self.std(numeric_only=numeric_only) / ( self.count(numeric_only) - ddof ).pow(0.5) @@ -2448,7 +2354,6 @@ def sem(self, ddof: int = 1, numeric_only: bool = False, *args, **kwargs): template_header, create_section_header("Parameters"), kwargs_numeric_only, - kwargs_compat, create_section_header("Returns"), template_returns, create_section_header("See Also"), @@ -2482,9 +2387,8 @@ def sem(self, ddof: int = 1, numeric_only: bool = False, *args, **kwargs): aggregation_description="Fisher's definition of kurtosis without bias", agg_method="kurt", ) - def kurt(self, numeric_only: bool = False, **kwargs): - maybe_warn_args_and_kwargs(type(self), "kurt", None, kwargs) - return super().kurt(numeric_only=numeric_only, **kwargs) + def kurt(self, numeric_only: bool = False): + return super().kurt(numeric_only=numeric_only) @doc( template_header, @@ -2506,7 +2410,6 @@ def kurt(self, numeric_only: bool = False, **kwargs): """ ).replace("\n", "", 1), kwargs_numeric_only, - kwargs_compat, create_section_header("Returns"), template_returns, create_section_header("See Also"), @@ -2539,14 +2442,11 @@ def quantile( quantile: float, interpolation: QuantileInterpolation = "linear", numeric_only: bool = False, - **kwargs, ): - maybe_warn_args_and_kwargs(type(self), "quantile", None, kwargs) return super().quantile( quantile=quantile, interpolation=interpolation, numeric_only=numeric_only, - **kwargs, ) @doc( @@ -2570,7 +2470,6 @@ def quantile( """ ).replace("\n", "", 1), kwargs_numeric_only, - kwargs_compat, create_section_header("Returns"), template_returns, create_section_header("See Also"), @@ -2617,15 +2516,12 @@ def rank( ascending: bool = True, pct: bool = False, numeric_only: bool = False, - **kwargs, ): - maybe_warn_args_and_kwargs(type(self), "rank", None, kwargs) return super().rank( method=method, ascending=ascending, pct=pct, numeric_only=numeric_only, - **kwargs, ) @doc( @@ -2649,7 +2545,6 @@ def rank( """ ).replace("\n", "", 1), kwargs_numeric_only, - kwargs_compat, create_section_header("Returns"), template_returns, create_section_header("See Also"), @@ -2664,15 +2559,12 @@ def cov( pairwise: bool | None = None, ddof: int = 1, numeric_only: bool = False, - **kwargs, ): - maybe_warn_args_and_kwargs(type(self), "cov", None, kwargs) return super().cov( other=other, pairwise=pairwise, ddof=ddof, numeric_only=numeric_only, - **kwargs, ) @doc( @@ -2696,7 +2588,6 @@ def cov( """ ).replace("\n", "", 1), kwargs_numeric_only, - kwargs_compat, create_section_header("Returns"), template_returns, create_section_header("See Also"), @@ -2798,15 +2689,12 @@ def corr( pairwise: bool | None = None, ddof: int = 1, numeric_only: bool = False, - **kwargs, ): - maybe_warn_args_and_kwargs(type(self), "corr", None, kwargs) return super().corr( other=other, pairwise=pairwise, ddof=ddof, numeric_only=numeric_only, - **kwargs, ) diff --git a/pandas/tests/window/moments/test_moments_consistency_ewm.py b/pandas/tests/window/moments/test_moments_consistency_ewm.py index aaa1010a4798b..1d58c64d55b15 100644 --- a/pandas/tests/window/moments/test_moments_consistency_ewm.py +++ b/pandas/tests/window/moments/test_moments_consistency_ewm.py @@ -220,10 +220,9 @@ def test_ewm_consistency_series_cov_corr( # check that corr(x, y) == cov(x, y) / (std(x) * # std(y)) - with tm.assert_produces_warning(FutureWarning, match="Passing additional kwargs"): - corr_x_y = series_data.ewm( - com=com, min_periods=min_periods, adjust=adjust, ignore_na=ignore_na - ).corr(series_data, bias=bias) + corr_x_y = series_data.ewm( + com=com, min_periods=min_periods, adjust=adjust, ignore_na=ignore_na + ).corr(series_data) std_x = series_data.ewm( com=com, min_periods=min_periods, adjust=adjust, ignore_na=ignore_na ).std(bias=bias) diff --git a/pandas/tests/window/test_api.py b/pandas/tests/window/test_api.py index d55e398acf992..3c9c2f5b20ae2 100644 --- a/pandas/tests/window/test_api.py +++ b/pandas/tests/window/test_api.py @@ -1,10 +1,7 @@ import numpy as np import pytest -from pandas.errors import ( - SpecificationError, - UnsupportedFunctionCall, -) +from pandas.errors import SpecificationError from pandas import ( DataFrame, @@ -400,78 +397,3 @@ def test_rolling_max_min_periods(step): msg = "min_periods 5 must be <= window 3" with pytest.raises(ValueError, match=msg): Series([1, 2, 3]).rolling(window=3, min_periods=5, step=step).max() - - -@pytest.mark.parametrize( - "roll_type, class_name", - [ - ("rolling", "Rolling"), - ("expanding", "Expanding"), - ("ewm", "ExponentialMovingWindow"), - ], -) -@pytest.mark.parametrize( - "kernel, has_args, raises", - [ - ("sum", True, True), - ("max", True, True), - ("min", True, True), - ("mean", True, True), - ("median", False, False), - ("std", True, True), - ("var", True, True), - ("skew", False, False), - ("sem", True, True), - ("kurt", False, False), - ("quantile", False, False), - ("rank", False, False), - ("cov", False, False), - ("corr", False, False), - ], -) -def test_args_kwargs_depr(roll_type, class_name, kernel, has_args, raises): - # GH#47836 - r = getattr(Series([2, 4, 6]), roll_type)(2) - error_msg = "numpy operations are not valid with window objects" - if kernel == "quantile": - required_args = (0.5,) - else: - required_args = () - - if roll_type == "ewm" and kernel not in ( - "sum", - "mean", - "std", - "var", - "cov", - "corr", - ): - # kernels not implemented for ewm - with pytest.raises(AttributeError, match=f"has no attribute '{kernel}'"): - getattr(r, kernel) - else: - warn_msg = f"Passing additional kwargs to {class_name}.{kernel}" - with tm.assert_produces_warning(FutureWarning, match=warn_msg): - if raises: - with pytest.raises(UnsupportedFunctionCall, match=error_msg): - getattr(r, kernel)(*required_args, dtype=np.float64) - else: - getattr(r, kernel)(*required_args, dtype=np.float64) - - if has_args: - warn_msg = f"Passing additional args to {class_name}.{kernel}" - with tm.assert_produces_warning(FutureWarning, match=warn_msg): - # sem raises for rolling but not expanding - if raises and (roll_type != "expanding" or kernel != "sem"): - with pytest.raises(UnsupportedFunctionCall, match=error_msg): - getattr(r, kernel)(*required_args, 1, 2, 3, 4) - else: - getattr(r, kernel)(*required_args, 1, 2, 3, 4) - - warn_msg = f"Passing additional args and kwargs to {class_name}.{kernel}" - with tm.assert_produces_warning(FutureWarning, match=warn_msg): - if raises: - with pytest.raises(UnsupportedFunctionCall, match=error_msg): - getattr(r, kernel)(*required_args, 1, 2, 3, 4, dtype=np.float64) - else: - getattr(r, kernel)(*required_args, 1, 2, 3, 4, dtype=np.float64) diff --git a/pandas/tests/window/test_ewm.py b/pandas/tests/window/test_ewm.py index 887e6d317689a..f88c20f2f78c6 100644 --- a/pandas/tests/window/test_ewm.py +++ b/pandas/tests/window/test_ewm.py @@ -1,8 +1,6 @@ import numpy as np import pytest -from pandas.errors import UnsupportedFunctionCall - from pandas import ( DataFrame, DatetimeIndex, @@ -10,7 +8,6 @@ date_range, ) import pandas._testing as tm -from pandas.core.window import ExponentialMovingWindow def test_doc_string(): @@ -64,23 +61,6 @@ def test_constructor(frame_or_series): c(alpha=alpha) -@pytest.mark.parametrize("method", ["std", "mean", "var"]) -def test_numpy_compat(method): - # see gh-12811 - e = ExponentialMovingWindow(Series([2, 4, 6]), alpha=0.5) - - error_msg = "numpy operations are not valid with window objects" - - warn_msg = f"Passing additional args to ExponentialMovingWindow.{method}" - with tm.assert_produces_warning(FutureWarning, match=warn_msg): - with pytest.raises(UnsupportedFunctionCall, match=error_msg): - getattr(e, method)(1, 2, 3) - warn_msg = f"Passing additional kwargs to ExponentialMovingWindow.{method}" - with tm.assert_produces_warning(FutureWarning, match=warn_msg): - with pytest.raises(UnsupportedFunctionCall, match=error_msg): - getattr(e, method)(dtype=np.float64) - - def test_ewma_times_not_datetime_type(): msg = r"times must be datetime64\[ns\] dtype." with pytest.raises(ValueError, match=msg): diff --git a/pandas/tests/window/test_expanding.py b/pandas/tests/window/test_expanding.py index d30e3d7afcf19..64e732e89a0dc 100644 --- a/pandas/tests/window/test_expanding.py +++ b/pandas/tests/window/test_expanding.py @@ -1,8 +1,6 @@ import numpy as np import pytest -from pandas.errors import UnsupportedFunctionCall - from pandas import ( DataFrame, DatetimeIndex, @@ -13,7 +11,6 @@ notna, ) import pandas._testing as tm -from pandas.core.window import Expanding def test_doc_string(): @@ -42,23 +39,6 @@ def test_constructor_invalid(frame_or_series, w): c(min_periods=w) -@pytest.mark.parametrize("method", ["std", "mean", "sum", "max", "min", "var"]) -def test_numpy_compat(method): - # see gh-12811 - e = Expanding(Series([2, 4, 6])) - - error_msg = "numpy operations are not valid with window objects" - - warn_msg = f"Passing additional args to Expanding.{method}" - with tm.assert_produces_warning(FutureWarning, match=warn_msg): - with pytest.raises(UnsupportedFunctionCall, match=error_msg): - getattr(e, method)(1, 2, 3) - warn_msg = f"Passing additional kwargs to Expanding.{method}" - with tm.assert_produces_warning(FutureWarning, match=warn_msg): - with pytest.raises(UnsupportedFunctionCall, match=error_msg): - getattr(e, method)(dtype=np.float64) - - @pytest.mark.parametrize( "expander", [ diff --git a/pandas/tests/window/test_rolling.py b/pandas/tests/window/test_rolling.py index 474d87ee5639a..491c95df7ebcf 100644 --- a/pandas/tests/window/test_rolling.py +++ b/pandas/tests/window/test_rolling.py @@ -10,7 +10,6 @@ is_platform_arm, is_platform_mac, ) -from pandas.errors import UnsupportedFunctionCall from pandas import ( DataFrame, @@ -27,7 +26,6 @@ import pandas._testing as tm from pandas.api.indexers import BaseIndexer from pandas.core.indexers.objects import VariableOffsetWindowIndexer -from pandas.core.window import Rolling from pandas.tseries.offsets import BusinessDay @@ -153,23 +151,6 @@ def test_constructor_timedelta_window_and_minperiods(window, raw): tm.assert_frame_equal(result_roll_generic, expected) -@pytest.mark.parametrize("method", ["std", "mean", "sum", "max", "min", "var"]) -def test_numpy_compat(method): - # see gh-12811 - r = Rolling(Series([2, 4, 6]), window=2) - - error_msg = "numpy operations are not valid with window objects" - - warn_msg = f"Passing additional args to Rolling.{method}" - with tm.assert_produces_warning(FutureWarning, match=warn_msg): - with pytest.raises(UnsupportedFunctionCall, match=error_msg): - getattr(r, method)(1, 2, 3) - warn_msg = f"Passing additional kwargs to Rolling.{method}" - with tm.assert_produces_warning(FutureWarning, match=warn_msg): - with pytest.raises(UnsupportedFunctionCall, match=error_msg): - getattr(r, method)(dtype=np.float64) - - def test_closed_fixed(closed, arithmetic_win_operators): # GH 34315 func_name = arithmetic_win_operators diff --git a/pandas/tests/window/test_win_type.py b/pandas/tests/window/test_win_type.py index b5206d802776b..71a7f8e76d058 100644 --- a/pandas/tests/window/test_win_type.py +++ b/pandas/tests/window/test_win_type.py @@ -1,7 +1,6 @@ import numpy as np import pytest -from pandas.errors import UnsupportedFunctionCall import pandas.util._test_decorators as td from pandas import ( @@ -74,23 +73,6 @@ def test_constructor_with_win_type(frame_or_series, win_types): c(win_type=win_types, window=2) -@pytest.mark.parametrize("method", ["sum", "mean"]) -def test_numpy_compat(method): - # see gh-12811 - w = Series([2, 4, 6]).rolling(window=2) - - error_msg = "numpy operations are not valid with window objects" - - warn_msg = f"Passing additional args to Rolling.{method}" - with tm.assert_produces_warning(FutureWarning, match=warn_msg): - with pytest.raises(UnsupportedFunctionCall, match=error_msg): - getattr(w, method)(1, 2, 3) - warn_msg = f"Passing additional kwargs to Rolling.{method}" - with tm.assert_produces_warning(FutureWarning, match=warn_msg): - with pytest.raises(UnsupportedFunctionCall, match=error_msg): - getattr(w, method)(dtype=np.float64) - - @td.skip_if_no_scipy @pytest.mark.parametrize("arg", ["median", "kurt", "skew"]) def test_agg_function_support(arg):