Skip to content

Commit

Permalink
PERF: exchanged boolean array creation to method with less overhead
Browse files Browse the repository at this point in the history
  • Loading branch information
ChronoJon committed Oct 8, 2023
1 parent e2b826b commit e55a1e4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pandas/core/arrays/string_arrow.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ def _str_startswith(self, pat: str | tuple[str, ...], na: Scalar | None = None):
# mimic existing behaviour of string extension array
# and python string method
result = pa.array(
np.full(len(self._pa_array), False), mask=isna(self._pa_array)
np.zeros(len(self._pa_array), dtype=bool), mask=isna(self._pa_array)
)
else:
result = pc.starts_with(self._pa_array, pattern=pat[0])
Expand All @@ -362,7 +362,7 @@ def _str_endswith(self, pat: str | tuple[str, ...], na: Scalar | None = None):
# mimic existing behaviour of string extension array
# and python string method
result = pa.array(
np.full(len(self._pa_array), False), mask=isna(self._pa_array)
np.zeros(len(self._pa_array), dtype=bool), mask=isna(self._pa_array)
)
else:
result = pc.ends_with(self._pa_array, pattern=pat[0])
Expand Down

0 comments on commit e55a1e4

Please sign in to comment.