Skip to content

Commit d134e8d

Browse files
committed
add keepdims keyword to StringArray._reduce
1 parent 5b9edec commit d134e8d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

pandas/core/arrays/string_.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -522,11 +522,17 @@ def astype(self, dtype, copy: bool = True):
522522
return super().astype(dtype, copy)
523523

524524
def _reduce(
525-
self, name: str, *, skipna: bool = True, axis: AxisInt | None = 0, **kwargs
525+
self,
526+
name: str,
527+
*,
528+
skipna: bool = True,
529+
keepdims: bool = False,
530+
axis: AxisInt | None = 0,
531+
**kwargs,
526532
):
527533
if name in ["min", "max"]:
528534
result = getattr(self, name)(skipna=skipna, axis=axis)
529-
if kwargs.get("keepdims"):
535+
if keepdims:
530536
return self._from_sequence([result], dtype=self.dtype)
531537
return result
532538

0 commit comments

Comments
 (0)