Skip to content

Commit 04dda0d

Browse files
committed
updated test and map condition
1 parent a421e66 commit 04dda0d

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

pandas/core/arrays/arrow/array.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1481,12 +1481,8 @@ def to_numpy(
14811481
return result
14821482

14831483
def map(self, mapper, na_action: Literal["ignore"] | None = None):
1484-
if is_numeric_dtype(self.dtype):
1484+
if is_numeric_dtype(self.dtype) or self.dtype.kind in "mM":
14851485
return map_array(self.to_numpy(), mapper, na_action=na_action)
1486-
elif self.dtype == "timestamp[ns][pyarrow]":
1487-
return map_array(
1488-
self.to_numpy(dtype="datetime64[ns]"), mapper, na_action=na_action
1489-
)
14901486
else:
14911487
return super().map(mapper, na_action)
14921488

pandas/tests/extension/test_arrow.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -281,7 +281,7 @@ def test_compare_scalar(self, data, comparison_op):
281281
@pytest.mark.parametrize("na_action", [None, "ignore"])
282282
def test_map(self, data_missing, na_action):
283283
if data_missing.dtype.kind in "mM":
284-
result = data_missing.map(lambda x: x, na_action=na_action)
284+
result = data_missing.map(lambda x: x, na_action=na_action).to_numpy(dtype=object)
285285
expected = data_missing.to_numpy(dtype=object)
286286
tm.assert_numpy_array_equal(result, expected)
287287
else:

0 commit comments

Comments
 (0)