Skip to content

Commit 76541f5

Browse files
authored
REF: remove axis keyword from PandasArray.pad_or_backfill (#53941)
* REF: remove axis keyword from PandasArray.pad_or_backfill * transpose
1 parent dd16728 commit 76541f5

File tree

2 files changed

+8
-5
lines changed

2 files changed

+8
-5
lines changed

pandas/core/arrays/numpy_.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -233,13 +233,12 @@ def pad_or_backfill(
233233
self,
234234
*,
235235
method: FillnaOptions,
236-
axis: int,
237236
limit: int | None,
238237
limit_area: Literal["inside", "outside"] | None = None,
239238
copy: bool = True,
240239
) -> Self:
241240
"""
242-
ffill or bfill
241+
ffill or bfill along axis=0.
243242
"""
244243
if copy:
245244
out_data = self._ndarray.copy()
@@ -250,7 +249,7 @@ def pad_or_backfill(
250249
missing.pad_or_backfill_inplace(
251250
out_data,
252251
method=meth,
253-
axis=axis,
252+
axis=0,
254253
limit=limit,
255254
limit_area=limit_area,
256255
)

pandas/core/internals/blocks.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -1366,13 +1366,17 @@ def pad_or_backfill(
13661366

13671367
# Dispatch to the PandasArray method.
13681368
# We know self.array_values is a PandasArray bc EABlock overrides
1369-
new_values = cast(PandasArray, self.array_values).pad_or_backfill(
1369+
vals = cast(PandasArray, self.array_values)
1370+
if axis == 1:
1371+
vals = vals.T
1372+
new_values = vals.pad_or_backfill(
13701373
method=method,
1371-
axis=axis,
13721374
limit=limit,
13731375
limit_area=limit_area,
13741376
copy=copy,
13751377
)
1378+
if axis == 1:
1379+
new_values = new_values.T
13761380

13771381
data = extract_array(new_values, extract_numpy=True)
13781382

0 commit comments

Comments
 (0)