Skip to content

Commit bd1b70c

Browse files
committed
fix stringdtype issue
1 parent ffb2a6f commit bd1b70c

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

pandas/core/arrays/arrow/array.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1478,10 +1478,12 @@ def to_numpy(
14781478
return result
14791479

14801480
def map(self, mapper, na_action: Literal["ignore"] | None = None):
1481-
if (
1482-
is_numeric_dtype(self.dtype)
1483-
or pa.types.is_date(self.dtype.pyarrow_dtype)
1484-
or pa.types.is_timestamp(self.dtype.pyarrow_dtype)
1481+
if not is_string_dtype(self.dtype) and any(
1482+
[
1483+
is_numeric_dtype(self.dtype)
1484+
or pa.types.is_date(self.dtype.pyarrow_dtype)
1485+
or pa.types.is_timestamp(self.dtype.pyarrow_dtype)
1486+
]
14851487
):
14861488
return map_array(self.to_numpy(), mapper, na_action=na_action)
14871489
else:

0 commit comments

Comments
 (0)