-
-
Notifications
You must be signed in to change notification settings - Fork 19.3k
REF: use _cast_pointwise_result in map #62177
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
Conversation
|
Hi @jbrockmendel , |
|
Please use your best judgement. |
|
Okay, thanks.. I’ll update the tests to keep things consistent and aligned with user expectations. |
pandas/core/arrays/arrow/array.py
Outdated
| def map(self, mapper, na_action: Literal["ignore"] | None = None): | ||
| def map(self, mapper, | ||
| na_action: Literal["ignore"] | None = None, | ||
| preserve_dtype: bool = False): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why is a new keyword getting added?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i see, you're trying to avoid changing any old behavior. in this case, the new behavior should be generally better than the old behavior. if you find cases where it isn't, those likely represent bugs in _cast_pointwise_result.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
while trying to put the _casr_pointwise_result in map and updating the test cases, like you mentioned, I faced some bugs. It was not fully implemented for some particular niche types. (truediv , rtruediv or ns, ms ) and while I don't remember all the types.. this function definitely needs few more updates...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you find other bugs, please open issues about them
| self, | ||
| mapper, | ||
| na_action: Literal["ignore"] | None = None, | ||
| preserve_dtype: bool = False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we don't want this new keyword.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as the current implementation is not working for all the types, do you have a suggestion on how I should approach this without introducing the new keyword?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
same as i said here #62177 (comment)
| self, | ||
| n: PositionalIndexer | tuple, | ||
| dropna: Literal["any", "all", None] = None, | ||
| dropna: Literal["any", "all"] | None = None, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pls avoid unrelated changes
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, but due to a ci check on formatting, I used ruff and it changed few files. Thanks for pointing out, I will revert it back.
|
This pull request is stale because it has been open for thirty days with no activity. Please update and respond to this comment if you're still interested in working on this. |
|
Closing as stale. If you'd like to address the comments above we can re-open. |
test_base_map_dtype_preservation.pydoc/source/whatsnew/v3.0.0.rstfile if fixing a bug or adding a new feature.