diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 52857fed5b95f..c695c04052f9d 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -10936,10 +10936,8 @@ def quantile( if needs_i8_conversion(cdtype): dtype = cdtype - if is_list_like(q): - res = self._constructor([], index=q, columns=cols, dtype=dtype) - return res.__finalize__(self, method="quantile") - return self._constructor_sliced([], index=cols, name=q, dtype=dtype) + res = self._constructor([], index=q, columns=cols, dtype=dtype) + return res.__finalize__(self, method="quantile") res = data._mgr.quantile(qs=q, axis=1, interpolation=interpolation) diff --git a/pandas/tests/generic/test_finalize.py b/pandas/tests/generic/test_finalize.py index 540a30e691d3c..6901d415a5ae7 100644 --- a/pandas/tests/generic/test_finalize.py +++ b/pandas/tests/generic/test_finalize.py @@ -262,6 +262,13 @@ operator.methodcaller("quantile", numeric_only=False), ), ), + pytest.param( + ( + pd.DataFrame, + ({"A": [np.datetime64("2022-01-01"), np.datetime64("2022-01-02")]},), + operator.methodcaller("quantile", numeric_only=True), + ), + ), ( pd.DataFrame, ({"A": [1]}, [pd.Period("2000", "D")]),