Skip to content

BUG: Add PyArrow datelike type support for map() #61644

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion pandas/core/arrays/arrow/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -1478,7 +1478,11 @@ def to_numpy(
return result

def map(self, mapper, na_action: Literal["ignore"] | None = None):
if is_numeric_dtype(self.dtype):
if (
is_numeric_dtype(self.dtype)
or pa.types.is_date(self.dtype.pyarrow_dtype)
or pa.types.is_timestamp(self.dtype.pyarrow_dtype)
):
return map_array(self.to_numpy(), mapper, na_action=na_action)
else:
return super().map(mapper, na_action)
Expand Down
Loading