diff --git a/pandas/core/frame.py b/pandas/core/frame.py index 3dac13df6b670..746c555edc989 100644 --- a/pandas/core/frame.py +++ b/pandas/core/frame.py @@ -11502,7 +11502,7 @@ def quantile( f"Invalid method: {method}. Method must be in {valid_method}." ) if method == "single": - res = data._mgr.quantile(qs=q, axis=1, interpolation=interpolation) + res = data._mgr.quantile(qs=q, interpolation=interpolation) elif method == "table": valid_interpolation = {"nearest", "lower", "higher"} if interpolation not in valid_interpolation: diff --git a/pandas/core/internals/array_manager.py b/pandas/core/internals/array_manager.py index 80bddb586fc53..f939ce469aab4 100644 --- a/pandas/core/internals/array_manager.py +++ b/pandas/core/internals/array_manager.py @@ -324,12 +324,6 @@ def diff(self, n: int) -> Self: assert self.ndim == 2 # caller ensures return self.apply(algos.diff, n=n) - def shift(self, periods: int, fill_value) -> Self: - if fill_value is lib.no_default: - fill_value = None - - return self.apply_with_block("shift", periods=periods, fill_value=fill_value) - def astype(self, dtype, copy: bool | None = False, errors: str = "raise") -> Self: if copy is None: copy = True @@ -930,12 +924,10 @@ def quantile( self, *, qs: Index, # with dtype float64 - axis: AxisInt = 0, transposed: bool = False, interpolation: QuantileInterpolation = "linear", ) -> ArrayManager: arrs = [ensure_block_shape(x, 2) for x in self.arrays] - assert axis == 1 new_arrs = [ quantile_compat(x, np.asarray(qs._values), interpolation) for x in arrs ] diff --git a/pandas/core/internals/base.py b/pandas/core/internals/base.py index 14aa2cc2716b9..bd5792ef34f6a 100644 --- a/pandas/core/internals/base.py +++ b/pandas/core/internals/base.py @@ -269,6 +269,12 @@ def pad_or_backfill(self, inplace: bool, **kwargs) -> Self: using_cow=using_copy_on_write(), ) + def shift(self, periods: int, fill_value) -> Self: + if fill_value is lib.no_default: + fill_value = None + + return self.apply_with_block("shift", periods=periods, fill_value=fill_value) + # -------------------------------------------------------------------- # Consolidation: No-ops for all but BlockManager diff --git a/pandas/core/internals/blocks.py b/pandas/core/internals/blocks.py index adfe11e83cdcc..832e1560ae55e 100644 --- a/pandas/core/internals/blocks.py +++ b/pandas/core/internals/blocks.py @@ -1511,7 +1511,6 @@ def quantile( self, qs: Index, # with dtype float64 interpolation: QuantileInterpolation = "linear", - axis: AxisInt = 0, ) -> Block: """ compute the quantiles of the @@ -1522,8 +1521,6 @@ def quantile( The quantiles to be computed in float64. interpolation : str, default 'linear' Type of interpolation. - axis : int, default 0 - Axis to compute. Returns ------- @@ -1531,7 +1528,6 @@ def quantile( """ # We should always have ndim == 2 because Series dispatches to DataFrame assert self.ndim == 2 - assert axis == 1 # only ever called this way assert is_list_like(qs) # caller is responsible for this result = quantile_compat(self.values, np.asarray(qs._values), interpolation) diff --git a/pandas/core/internals/managers.py b/pandas/core/internals/managers.py index f4c8b101d9f12..dc08f719ffa5f 100644 --- a/pandas/core/internals/managers.py +++ b/pandas/core/internals/managers.py @@ -378,12 +378,6 @@ def diff(self, n: int) -> Self: # only reached with self.ndim == 2 return self.apply("diff", n=n) - def shift(self, periods: int, fill_value) -> Self: - if fill_value is lib.no_default: - fill_value = None - - return self.apply("shift", periods=periods, fill_value=fill_value) - def astype(self, dtype, copy: bool | None = False, errors: str = "raise") -> Self: if copy is None: if using_copy_on_write(): @@ -1463,7 +1457,6 @@ def quantile( self, *, qs: Index, # with dtype float 64 - axis: AxisInt = 0, interpolation: QuantileInterpolation = "linear", ) -> Self: """ @@ -1473,9 +1466,6 @@ def quantile( Parameters ---------- - axis: reduction axis, default 0 - consolidate: bool, default True. Join together blocks having same - dtype interpolation : type of interpolation, default 'linear' qs : list of the quantiles to be computed @@ -1487,14 +1477,12 @@ def quantile( # simplify some of the code here and in the blocks assert self.ndim >= 2 assert is_list_like(qs) # caller is responsible for this - assert axis == 1 # only ever called this way new_axes = list(self.axes) new_axes[1] = Index(qs, dtype=np.float64) blocks = [ - blk.quantile(axis=axis, qs=qs, interpolation=interpolation) - for blk in self.blocks + blk.quantile(qs=qs, interpolation=interpolation) for blk in self.blocks ] return type(self)(blocks, new_axes)