Skip to content
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

BUG/TST: Fix TimedeltaIndex comparisons with invalid types #24056

Merged
merged 12 commits into from
Dec 5, 2018

Conversation

jbrockmendel
Copy link
Member

Parametrize a handful of tests.

@pep8speaks
Copy link

Hello @jbrockmendel! Thanks for submitting the PR.

@jreback jreback added Error Reporting Incorrect or improved errors from pandas Timedelta Timedelta data type labels Dec 3, 2018
if not hasattr(values, "dtype"):
if np.ndim(values) == 0:
# i.e. iterator
values = list(values)
Copy link
Contributor

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?

Copy link
Member Author

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:
Copy link
Contributor

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

Copy link
Member Author

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
Copy link

codecov bot commented Dec 3, 2018

Codecov Report

Merging #24056 into master will increase coverage by 0.05%.
The diff coverage is 47.05%.

Impacted file tree graph

@@            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
Flag Coverage Δ
#single 42.44% <47.05%> (+0.05%) ⬆️
Impacted Files Coverage Δ
pandas/util/testing.py 51.71% <0%> (-0.1%) ⬇️
pandas/core/ops.py 55.2% <100%> (ø) ⬆️
pandas/core/generic.py 39.36% <100%> (+0.02%) ⬆️
pandas/core/arrays/datetimes.py 63.17% <40%> (-0.62%) ⬇️
pandas/core/arrays/timedeltas.py 50.14% <50%> (+11.17%) ⬆️
pandas/core/indexes/period.py 39.82% <0%> (-1.03%) ⬇️
pandas/core/indexes/timedeltas.py 39.82% <0%> (-1.02%) ⬇️
pandas/core/dtypes/common.py 69.9% <0%> (-0.5%) ⬇️
pandas/core/indexes/datetimes.py 52.18% <0%> (-0.14%) ⬇️
pandas/core/arrays/integer.py 37.97% <0%> (-0.09%) ⬇️
... and 23 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 08395af...9df94d9. Read the comment docs.

@codecov
Copy link

codecov bot commented Dec 3, 2018

Codecov Report

Merging #24056 into master will decrease coverage by <.01%.
The diff coverage is 83.33%.

Impacted file tree graph

@@            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
Flag Coverage Δ
#multiple 90.6% <83.33%> (-0.01%) ⬇️
#single 43% <50%> (-0.01%) ⬇️
Impacted Files Coverage Δ
pandas/util/testing.py 87.41% <100%> (+0.02%) ⬆️
pandas/core/ops.py 94.13% <100%> (ø) ⬆️
pandas/core/generic.py 96.65% <100%> (ø) ⬆️
pandas/core/arrays/timedeltas.py 87.27% <77.77%> (-0.34%) ⬇️
pandas/core/arrays/datetimes.py 98.25% <80%> (-0.18%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4b5f4d1...9b02f5d. Read the comment docs.

@jreback jreback added this to the 0.24.0 milestone Dec 5, 2018
@jreback jreback merged commit 6919013 into pandas-dev:master Dec 5, 2018
@jreback
Copy link
Contributor

jreback commented Dec 5, 2018

thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Error Reporting Incorrect or improved errors from pandas Timedelta Timedelta data type
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: TimedeltaIndex == integer raises TypeError
3 participants