Skip to content

Commit

Permalink
Merge pull request #1 from SusmithBarigidad/SusmithBarigidad-patch-1
Browse files Browse the repository at this point in the history
 Support min/max on ArrowStringArray pandas-dev#42597
  • Loading branch information
SusmithBarigidad committed Jul 18, 2021
2 parents 1cbf344 + 8461b77 commit 14c0cbb
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions pandas/core/arrays/string_arrow.py
Expand Up @@ -379,6 +379,20 @@ def _reduce(self, name: str, skipna: bool = True, **kwargs):
return getattr(self, name)(skipna=skipna)

raise TypeError(f"Cannot perform reduction '{name}' with string dtype")

def min(self, axis=None, skipna: bool = True, **kwargs) -> Scalar:
nv.validate_min((), kwargs)
result = masked_reductions.min(
values=self.to_numpy(), mask=self.isna(), skipna=skipna
)
return self._wrap_reduction_result(axis, result)

def max(self, axis=None, skipna: bool = True, **kwargs) -> Scalar:
nv.validate_max((), kwargs)
result = masked_reductions.max(
values=self.to_numpy(), mask=self.isna(), skipna=skipna
)
return self._wrap_reduction_result(axis, result)

@property
def nbytes(self) -> int:
Expand Down

0 comments on commit 14c0cbb

Please sign in to comment.