Skip to content

Surface NumPy FutureWarning about comparisons #26966

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

Merged
merged 3 commits into from
Jun 21, 2019

Conversation

TomAugspurger
Copy link
Contributor

Closes #22698

Specifically, see
#22698 (comment).

I don't think we need to worry about the others in #22698 (comment) datetimearray and integer array. I couldn't reproduce the returning a scalar behavior with those.

@TomAugspurger TomAugspurger added this to the 0.25.0 milestone Jun 20, 2019
@TomAugspurger
Copy link
Contributor Author

Oh, I was a bit confused... This happens with IntegerArray

In [7]: a = pd.array([1, None], dtype='Int64')

In [8]: a == 'a'
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
<ipython-input-8-3812dba97b6d> in <module>
----> 1 a == 'a'

~/sandbox/pandas/pandas/core/arrays/integer.py in cmp_method(self, other)
    561                 mask = self._mask | mask
    562
--> 563             result[mask] = op_name == 'ne'
    564             return result
    565

TypeError: 'bool' object does not support item assignment

So right now IntegerArray.__eq__(other) is broken when the op is using the deprecated behavior.

I don't think showing a warning here is useful. We could work around it I suppose?

@codecov
Copy link

codecov bot commented Jun 20, 2019

Codecov Report

Merging #26966 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #26966      +/-   ##
==========================================
- Coverage   91.87%   91.87%   -0.01%     
==========================================
  Files         180      180              
  Lines       50746    50744       -2     
==========================================
- Hits        46623    46621       -2     
  Misses       4123     4123
Flag Coverage Δ
#multiple 90.47% <100%> (ø) ⬆️
#single 41.1% <100%> (-0.09%) ⬇️
Impacted Files Coverage Δ
pandas/core/indexes/base.py 96.92% <100%> (+0.21%) ⬆️
pandas/io/gbq.py 88.88% <0%> (-11.12%) ⬇️
pandas/core/frame.py 96.89% <0%> (-0.12%) ⬇️

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 cfd65e9...8a967d2. Read the comment docs.

@codecov
Copy link

codecov bot commented Jun 20, 2019

Codecov Report

Merging #26966 into master will decrease coverage by <.01%.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master   #26966      +/-   ##
==========================================
- Coverage   91.87%   91.87%   -0.01%     
==========================================
  Files         180      180              
  Lines       50746    50744       -2     
==========================================
- Hits        46623    46621       -2     
  Misses       4123     4123
Flag Coverage Δ
#multiple 90.47% <100%> (ø) ⬆️
#single 41.1% <100%> (-0.09%) ⬇️
Impacted Files Coverage Δ
pandas/core/indexes/base.py 96.92% <100%> (+0.21%) ⬆️
pandas/io/gbq.py 88.88% <0%> (-11.12%) ⬇️
pandas/core/frame.py 96.89% <0%> (-0.12%) ⬇️

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 cfd65e9...add926f. Read the comment docs.

@gfyoung gfyoung added the Compat pandas objects compatability with Numpy or Python functions label Jun 20, 2019
@jreback
Copy link
Contributor

jreback commented Jun 21, 2019

looks fine. do we need to catch / suppress this in any of our tests?

@TomAugspurger
Copy link
Contributor Author

I don’t think we hit this anywhere else. If we did the NumPy dev build would be failing.

@jreback
Copy link
Contributor

jreback commented Jun 21, 2019

k thanks @TomAugspurger

@jreback jreback merged commit 06a3a03 into pandas-dev:master Jun 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Compat pandas objects compatability with Numpy or Python functions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Handle FutureWarning from NumPy in Series Construction
3 participants