Skip to content

CLN: Enforce rolling/expanding.quantile(quantile=) keyword #58605

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions doc/source/whatsnew/v3.0.0.rst
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,7 @@ Removal of prior version deprecations/changes
- Enforced deprecation of :meth:`offsets.Tick.delta`, use ``pd.Timedelta(obj)`` instead (:issue:`55498`)
- Enforced deprecation of ``axis=None`` acting the same as ``axis=0`` in the DataFrame reductions ``sum``, ``prod``, ``std``, ``var``, and ``sem``, passing ``axis=None`` will now reduce over both axes; this is particularly the case when doing e.g. ``numpy.sum(df)`` (:issue:`21597`)
- Enforced deprecation of ``core.internals`` members ``Block``, ``ExtensionBlock``, and ``DatetimeTZBlock`` (:issue:`58467`)
- Enforced deprecation of ``quantile`` keyword in :meth:`.Rolling.quantile` and :meth:`.Expanding.quantile`, renamed to ``q`` instead. (:issue:`52550`)
- Enforced deprecation of non-standard (``np.ndarray``, :class:`ExtensionArray`, :class:`Index`, or :class:`Series`) argument to :func:`api.extensions.take` (:issue:`52981`)
- Enforced deprecation of parsing system timezone strings to ``tzlocal``, which depended on system timezone, pass the 'tz' keyword instead (:issue:`50791`)
- Enforced deprecation of passing a dictionary to :meth:`SeriesGroupBy.agg` (:issue:`52268`)
Expand Down
6 changes: 1 addition & 5 deletions pandas/core/window/expanding.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,7 @@
Literal,
)

from pandas.util._decorators import (
deprecate_kwarg,
doc,
)
from pandas.util._decorators import doc

from pandas.core.indexers.objects import (
BaseIndexer,
Expand Down Expand Up @@ -709,7 +706,6 @@ def kurt(self, numeric_only: bool = False):
aggregation_description="quantile",
agg_method="quantile",
)
@deprecate_kwarg(old_arg_name="quantile", new_arg_name="q")
def quantile(
self,
q: float,
Expand Down
6 changes: 1 addition & 5 deletions pandas/core/window/rolling.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,7 @@
import pandas._libs.window.aggregations as window_aggregations
from pandas.compat._optional import import_optional_dependency
from pandas.errors import DataError
from pandas.util._decorators import (
deprecate_kwarg,
doc,
)
from pandas.util._decorators import doc

from pandas.core.dtypes.common import (
ensure_float64,
Expand Down Expand Up @@ -2556,7 +2553,6 @@ def kurt(self, numeric_only: bool = False):
aggregation_description="quantile",
agg_method="quantile",
)
@deprecate_kwarg(old_arg_name="quantile", new_arg_name="q")
def quantile(
self,
q: float,
Expand Down
9 changes: 0 additions & 9 deletions pandas/tests/window/test_expanding.py
Original file line number Diff line number Diff line change
Expand Up @@ -691,12 +691,3 @@ def test_numeric_only_corr_cov_series(kernel, use_arg, numeric_only, dtype):
op2 = getattr(expanding2, kernel)
expected = op2(*arg2, numeric_only=numeric_only)
tm.assert_series_equal(result, expected)


def test_keyword_quantile_deprecated():
# GH #52550
ser = Series([1, 2, 3, 4])
with tm.assert_produces_warning(
FutureWarning, match="the 'quantile' keyword is deprecated, use 'q' instead"
):
ser.expanding().quantile(quantile=0.5)
9 changes: 0 additions & 9 deletions pandas/tests/window/test_rolling_quantile.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,12 +173,3 @@ def test_center_reindex_frame(frame, q):
)
frame_rs = frame.rolling(window=25, center=True).quantile(q)
tm.assert_frame_equal(frame_xp, frame_rs)


def test_keyword_quantile_deprecated():
# GH #52550
s = Series([1, 2, 3, 4])
with tm.assert_produces_warning(
FutureWarning, match="the 'quantile' keyword is deprecated, use 'q' instead"
):
s.rolling(2).quantile(quantile=0.4)