diff --git a/pandas/core/generic.py b/pandas/core/generic.py index 701909c9df857..ee2a7454d261e 100644 --- a/pandas/core/generic.py +++ b/pandas/core/generic.py @@ -10460,7 +10460,8 @@ def _add_series_or_dataframe_operations(cls): Add the series or dataframe only operations to the cls; evaluate the doc strings again. """ - from pandas.core.window import EWM, Expanding, Rolling, Window + from pandas.core.window import exponentialmoving as em + from pandas.core.window import Expanding, Rolling, Window @doc(Rolling) def rolling( @@ -10507,7 +10508,7 @@ def expanding(self, min_periods=1, center=False, axis=0): cls.expanding = expanding - @doc(EWM) + @doc(em) def ewm( self, com=None, @@ -10520,7 +10521,7 @@ def ewm( axis=0, ): axis = self._get_axis_number(axis) - return EWM( + return EWF( self, com=com, span=span, @@ -10532,7 +10533,7 @@ def ewm( axis=axis, ) - cls.ewm = ewm + cls.eem = em @doc(klass=_shared_doc_kwargs["klass"], axis="") def transform(self, func, *args, **kwargs): diff --git a/pandas/core/window/__init__.py b/pandas/core/window/__init__.py index dcf58a4c0dd5b..d3e78f779fae8 100644 --- a/pandas/core/window/__init__.py +++ b/pandas/core/window/__init__.py @@ -1,3 +1,3 @@ -from pandas.core.window.ewm import EWM # noqa:F401 +from pandas.core.window.ewf import exponentialmoving # noqa:F401 from pandas.core.window.expanding import Expanding, ExpandingGroupby # noqa:F401 from pandas.core.window.rolling import Rolling, RollingGroupby, Window # noqa:F401 diff --git a/pandas/core/window/ewm.py b/pandas/core/window/exponentialmoving.py similarity index 98% rename from pandas/core/window/ewm.py rename to pandas/core/window/exponentialmoving.py index b708020be90d2..928dfb5dc16ff 100644 --- a/pandas/core/window/ewm.py +++ b/pandas/core/window/exponentialmoving.py @@ -59,11 +59,11 @@ def get_center_of_mass( return float(comass) -class EWM(_Rolling): +class Exponentialmoving(_Rolling): r""" - Provide exponential weighted (EW) functions. + Provide exponential weighted Functions(EWF). - Available EW functions: ``mean()``, ``var()``, ``std()``, ``corr()``, ``cov()``. + Available functions: ``mean()``, ``var()``, ``std()``, ``corr()``, ``cov()``. Exactly one parameter: ``com``, ``span``, ``halflife``, or ``alpha`` must be provided. @@ -185,7 +185,7 @@ def __init__( @property def _constructor(self): - return EWM + return EWF _agg_see_also_doc = dedent( """ diff --git a/pandas/tests/window/test_ewm.py b/pandas/tests/window/test_ewf.py similarity index 93% rename from pandas/tests/window/test_ewm.py rename to pandas/tests/window/test_ewf.py index 9ba194dcf0959..ae0f1bc47cf81 100644 --- a/pandas/tests/window/test_ewm.py +++ b/pandas/tests/window/test_ewf.py @@ -4,7 +4,7 @@ from pandas.errors import UnsupportedFunctionCall from pandas import DataFrame, Series -from pandas.core.window import EWM +from pandas.core.window import Exponentialmoving as em def test_doc_string(): @@ -56,7 +56,7 @@ def test_constructor(which): @pytest.mark.parametrize("method", ["std", "mean", "var"]) def test_numpy_compat(method): # see gh-12811 - e = EWM(Series([2, 4, 6]), alpha=0.5) + e = em(Series([2, 4, 6]), alpha=0.5) msg = "numpy operations are not valid with window objects"