Skip to content

Commit 18f3fd5

Browse files
simonjayhawkinsJulianWgs
authored andcommitted
[ArrowStringArray] PERF: small perf gain for object fallback (pandas-dev#41338)
1 parent 9436a60 commit 18f3fd5

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pandas/core/arrays/string_arrow.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -792,7 +792,8 @@ def _str_map(self, f, na_value=None, dtype: Dtype | None = None):
792792
result = lib.map_infer_mask(
793793
arr, f, mask.view("uint8"), convert=False, na_value=na_value
794794
)
795-
return self._from_sequence(result)
795+
result = pa.array(result, mask=mask, type=pa.string(), from_pandas=True)
796+
return type(self)(result)
796797
else:
797798
# This is when the result type is object. We reach this when
798799
# -> We know the result type is truly object (e.g. .encode returns bytes

0 commit comments

Comments
 (0)