File tree Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Expand file tree Collapse file tree 2 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -76,13 +76,8 @@ def cmp_method(self, other):
7676 result = ops ._comp_method_OBJECT_ARRAY (op , self .values , other )
7777
7878 else :
79-
80- # numpy will show a DeprecationWarning on invalid elementwise
81- # comparisons, this will raise in the future
82- with warnings .catch_warnings (record = True ):
83- warnings .filterwarnings ("ignore" , "elementwise" , FutureWarning )
84- with np .errstate (all = 'ignore' ):
85- result = op (self .values , np .asarray (other ))
79+ with np .errstate (all = 'ignore' ):
80+ result = op (self .values , np .asarray (other ))
8681
8782 # technically we could support bool dtyped Index
8883 # for now just return the indexing array directly
Original file line number Diff line number Diff line change @@ -80,3 +80,16 @@ def test_numpy_ufuncs_other(indices, func):
8080 else :
8181 with pytest .raises (Exception ):
8282 func (idx )
83+
84+
85+ def test_elementwise_comparison_warning ():
86+ # https://github.com/pandas-dev/pandas/issues/22698#issuecomment-458968300
87+ # np.array([1, 2]) == 'a' returns False, and produces a
88+ # FutureWarning that it'll be [False, False] in the future.
89+ # We just want to ensure that comes through.
90+ # When NumPy dev actually enforces this change, we'll need to skip
91+ # this test.
92+ idx = Index ([1 , 2 ])
93+ with tm .assert_produces_warning (FutureWarning ,
94+ check_stacklevel = False ):
95+ idx == 'a'
You can’t perform that action at this time.
0 commit comments