-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
CLN: _try_coerce_result, redundant dtypes.missing method #24619
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
pandas/core/internals/blocks.py
Outdated
@@ -2250,6 +2244,8 @@ def __init__(self, values, placement, ndim=2, dtype=None): | |||
# and just use DatetimeBlock's. | |||
if dtype is not None: | |||
values = self._maybe_coerce_values(values, dtype=dtype) | |||
# TODO: this gets hit in msgpack tests, but in all cases the values | |||
# are already DatetimeArrays with the appropriate dtype |
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.
this comment should be removed before merging, but if someone well-informed says its OK we may be able to get rid of this check and get some further simplification.
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.
where does this get hit?
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.
in the tests the only place this comes up is in test_packers
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.
you can certainly do this at a higher level. in packers you know the block type & have access to the _holder
; can just construct it and pass fully formed values, then don't need to pass the dtype thru
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.
Yah thats what Im thinking now, and it may actually make some of the other 24024 follow-ups easier. Anyway, just removed the comment.
Codecov Report
@@ Coverage Diff @@
## master #24619 +/- ##
==========================================
+ Coverage 92.37% 92.38% +<.01%
==========================================
Files 166 166
Lines 52396 52377 -19
==========================================
- Hits 48403 48388 -15
+ Misses 3993 3989 -4
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #24619 +/- ##
==========================================
+ Coverage 92.37% 92.38% +<.01%
==========================================
Files 166 166
Lines 52396 52376 -20
==========================================
- Hits 48403 48386 -17
+ Misses 3993 3990 -3
Continue to review full report at Codecov.
|
this overlaps with #24607 ? |
thanks! |
Started this branch with the idea of making DatetimeBlock, TimedeltaBlock, DatetimeTZBlock define _try_coerce_result using self._holder._from_sequence (which I still think is worthwhile, cc @TomAugspurger ) and got side-tracked. This ends up just being some cleanup and removal of a redundant method.
Tiny perf bump expected from optimizing NaT checks in _libs.missing. Further improvements/cleanups may be possible pending #24607.
The object-dtype cases in try_coerce_result are no longer hit following #24606.