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

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
8 changes: 7 additions & 1 deletion pandas/core/arrays/arrow/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -1478,7 +1478,13 @@ def to_numpy(
return result

def map(self, mapper, na_action: Literal["ignore"] | None = None):
if is_numeric_dtype(self.dtype):
if not is_string_dtype(self.dtype) and any(
[
is_numeric_dtype(self.dtype)
or pa.types.is_date(self.dtype.pyarrow_dtype)
or pa.types.is_timestamp(self.dtype.pyarrow_dtype)
]
):
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any idea why the super().map method isn't working correctly? If fixing things there is viable, that would be a better outcome

return map_array(self.to_numpy(), mapper, na_action=na_action)
else:
return super().map(mapper, na_action)
Expand Down
Loading