-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG/TST: Fix TimedeltaIndex comparisons with invalid types #24056
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
Hello @jbrockmendel! Thanks for submitting the PR.
|
if not hasattr(values, "dtype"): | ||
if np.ndim(values) == 0: | ||
# i.e. iterator | ||
values = list(values) |
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 have a test hit this?
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.
Yes
@@ -1115,7 +1115,7 @@ def dispatch_to_series(left, right, func, str_rep=None, axis=None): | |||
import pandas.core.computation.expressions as expressions | |||
|
|||
right = lib.item_from_zerodim(right) | |||
if lib.is_scalar(right): | |||
if lib.is_scalar(right) or np.ndim(right) == 0: |
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 this needed? this should already be handled by is_scalar
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.
because there are lots of weird things a user could pass that are zero-dim but not caught by is_scalar. The test case that hits this just passes object()
Codecov Report
@@ Coverage Diff @@
## master #24056 +/- ##
==========================================
+ Coverage 42.38% 42.44% +0.05%
==========================================
Files 161 161
Lines 51701 51573 -128
==========================================
- Hits 21914 21890 -24
+ Misses 29787 29683 -104
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #24056 +/- ##
==========================================
- Coverage 92.21% 92.2% -0.01%
==========================================
Files 161 161
Lines 51684 51696 +12
==========================================
+ Hits 47658 47667 +9
- Misses 4026 4029 +3
Continue to review full report at Codecov.
|
thanks! |
Parametrize a handful of tests.
git diff upstream/master -u -- "*.py" | flake8 --diff