Repository: pandas-dev/pandas

Issue:
ENH: Differing variable name for quantile vs rolling.quantile
### Feature Type

- [ ] Adding new functionality to pandas

- [X] Changing existing functionality in pandas

- [ ] Removing existing functionality in pandas


### Problem Description

As of V2 in the code and in the documentation, the quantile method and the rolling quantile method take a different variable for the quantile to be calculated.
https://pandas.pydata.org/docs/reference/api/pandas.DataFrame.quantile.html
https://pandas.pydata.org/docs/reference/api/pandas.core.window.rolling.Rolling.quantile.html

where we have: 
q float for the former (quantile) and
quantile float for the latter (rolling.quantile).

I feel like this is unnecessary and provides a small mental overhead.
I propose that it should be changed to being consistent. Not sure which is better, perhaps q as used in quantile and is shorter but clear.

### Feature Description

def rolling.quantile(self,
      q,
     ....):



### Alternative Solutions

quantile = q


### Additional Context

_No response_


Discussion:
would accept a PR deprecating the Rolling version to match
Hi @jbrockmendel I would like to make a PR for this, but this is the first time I make deprecation. Just want to make sure in advance, is the following approach acceptable?
```python
def quantile(self, q=None, interpolation="linear", numeric_only=False, *, quantile=None):
        if quantile is not None:
            warnings.warn(
                "The 'quantile' argument in Rolling.quantile "
                "has been deprecated. Use 'q' instead.",
                FutureWarning,
                stacklevel=find_stack_level(),
            )
            q = quantile if q is None else q

        # ...
```

Patch:
diff --git a/doc/source/whatsnew/v2.1.0.rst b/doc/source/whatsnew/v2.1.0.rst
index 1c0798e6cf9b1..e1ac9e3309de7 100644
--- a/doc/source/whatsnew/v2.1.0.rst
+++ b/doc/source/whatsnew/v2.1.0.rst
@@ -219,6 +219,7 @@ Deprecations
 ~~~~~~~~~~~~
 - Deprecated 'broadcast_axis' keyword in :meth:`Series.align` and :meth:`DataFrame.align`, upcast before calling ``align`` with ``left = DataFrame({col: left for col in right.columns}, index=right.index)`` (:issue:`51856`)
 - Deprecated 'method', 'limit', and 'fill_axis' keywords in :meth:`DataFrame.align` and :meth:`Series.align`, explicitly call ``fillna`` on the alignment results instead (:issue:`51856`)
+- Deprecated 'quantile' keyword in :meth:`Rolling.quantile` and :meth:`Expanding.quantile`, renamed as 'q' instead (:issue:`52550`)
 - Deprecated :meth:`.DataFrameGroupBy.apply` and methods on the objects returned by :meth:`.DataFrameGroupBy.resample` operating on the grouping column(s); select the columns to operate on after groupby to either explicitly include or exclude the groupings and avoid the ``FutureWarning`` (:issue:`7155`)
 - Deprecated :meth:`.Groupby.all` and :meth:`.GroupBy.any` with datetime64 or :class:`PeriodDtype` values, matching the :class:`Series` and :class:`DataFrame` deprecations (:issue:`34479`)
 - Deprecated :meth:`Categorical.to_list`, use ``obj.tolist()`` instead (:issue:`51254`)
diff --git a/pandas/core/window/expanding.py b/pandas/core/window/expanding.py
index fc22ff6c0522a..19dd98851611f 100644
--- a/pandas/core/window/expanding.py
+++ b/pandas/core/window/expanding.py
@@ -7,7 +7,10 @@
     Callable,
 )
 
-from pandas.util._decorators import doc
+from pandas.util._decorators import (
+    deprecate_kwarg,
+    doc,
+)
 
 from pandas.core.indexers.objects import (
     BaseIndexer,
@@ -575,6 +578,9 @@ def kurt(self, numeric_only: bool = False):
             """
         quantile : float
             Quantile to compute. 0 <= quantile <= 1.
+
+            .. deprecated:: 2.1.0
+                This will be renamed to 'q' in a future version.
         interpolation : {{'linear', 'lower', 'higher', 'midpoint', 'nearest'}}
             This optional parameter specifies the interpolation method to use,
             when the desired quantile lies between two data points `i` and `j`:
@@ -596,14 +602,15 @@ 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,
-        quantile: float,
+        q: float,
         interpolation: QuantileInterpolation = "linear",
         numeric_only: bool = False,
     ):
         return super().quantile(
-            quantile=quantile,
+            q=q,
             interpolation=interpolation,
             numeric_only=numeric_only,
         )
diff --git a/pandas/core/window/rolling.py b/pandas/core/window/rolling.py
index 57fda0a84c751..86b4e399fa461 100644
--- a/pandas/core/window/rolling.py
+++ b/pandas/core/window/rolling.py
@@ -28,7 +28,10 @@
 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 doc
+from pandas.util._decorators import (
+    deprecate_kwarg,
+    doc,
+)
 
 from pandas.core.dtypes.common import (
     ensure_float64,
@@ -1601,18 +1604,18 @@ def kurt(self, numeric_only: bool = False):
 
     def quantile(
         self,
-        quantile: float,
+        q: float,
         interpolation: QuantileInterpolation = "linear",
         numeric_only: bool = False,
     ):
-        if quantile == 1.0:
+        if q == 1.0:
             window_func = window_aggregations.roll_max
-        elif quantile == 0.0:
+        elif q == 0.0:
             window_func = window_aggregations.roll_min
         else:
             window_func = partial(
                 window_aggregations.roll_quantile,
-                quantile=quantile,
+                quantile=q,
                 interpolation=interpolation,
             )
 
@@ -2384,6 +2387,9 @@ def kurt(self, numeric_only: bool = False):
             """
         quantile : float
             Quantile to compute. 0 <= quantile <= 1.
+
+            .. deprecated:: 2.1.0
+                This will be renamed to 'q' in a future version.
         interpolation : {{'linear', 'lower', 'higher', 'midpoint', 'nearest'}}
             This optional parameter specifies the interpolation method to use,
             when the desired quantile lies between two data points `i` and `j`:
@@ -2424,14 +2430,15 @@ 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,
-        quantile: float,
+        q: float,
         interpolation: QuantileInterpolation = "linear",
         numeric_only: bool = False,
     ):
         return super().quantile(
-            quantile=quantile,
+            q=q,
             interpolation=interpolation,
             numeric_only=numeric_only,
         )


Test patch:
diff --git a/pandas/tests/window/test_expanding.py b/pandas/tests/window/test_expanding.py
index b4c5edeae949b..03af2e63da165 100644
--- a/pandas/tests/window/test_expanding.py
+++ b/pandas/tests/window/test_expanding.py
@@ -707,3 +707,10 @@ 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):
+        ser.expanding().quantile(quantile=0.5)
diff --git a/pandas/tests/window/test_rolling_functions.py b/pandas/tests/window/test_rolling_functions.py
index c4519701da7ab..c42f13d4b2235 100644
--- a/pandas/tests/window/test_rolling_functions.py
+++ b/pandas/tests/window/test_rolling_functions.py
@@ -340,7 +340,7 @@ def test_center_reindex_frame(frame, roll_func, kwargs, minp, fill_value):
         lambda x: x.rolling(window=10, min_periods=5).var(),
         lambda x: x.rolling(window=10, min_periods=5).skew(),
         lambda x: x.rolling(window=10, min_periods=5).kurt(),
-        lambda x: x.rolling(window=10, min_periods=5).quantile(quantile=0.5),
+        lambda x: x.rolling(window=10, min_periods=5).quantile(q=0.5),
         lambda x: x.rolling(window=10, min_periods=5).median(),
         lambda x: x.rolling(window=10, min_periods=5).apply(sum, raw=False),
         lambda x: x.rolling(window=10, min_periods=5).apply(sum, raw=True),
diff --git a/pandas/tests/window/test_rolling_quantile.py b/pandas/tests/window/test_rolling_quantile.py
index e78e997f220b5..2eba0b36ed187 100644
--- a/pandas/tests/window/test_rolling_quantile.py
+++ b/pandas/tests/window/test_rolling_quantile.py
@@ -173,3 +173,10 @@ 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):
+        s.rolling(2).quantile(quantile=0.4)