@@ -268,20 +268,20 @@ def test_rank_signature(self):
268
268
with pytest .raises (ValueError , match = msg ):
269
269
s .rank ("average" )
270
270
271
- def test_rank_tie_methods (self , ser , results , dtype , using_infer_string ):
271
+ def test_rank_tie_methods (
272
+ self , ser , results , dtype , using_infer_string , using_nan_is_na
273
+ ):
272
274
method , exp = results
273
275
if (
274
276
dtype == "int64"
275
- or dtype == "int64[pyarrow]"
276
- or dtype == "uint64[pyarrow]"
277
- or dtype == "float64[pyarrow]"
277
+ or (dtype in ["int64[pyarrow]" , "uint64[pyarrow]" ] and not using_nan_is_na )
278
278
or (not using_infer_string and dtype == "str" )
279
279
):
280
280
pytest .skip ("int64/str does not support NaN" )
281
281
282
282
ser = ser if dtype is None else ser .astype (dtype )
283
283
result = ser .rank (method = method )
284
- if dtype == "float64[pyarrow]" :
284
+ if dtype == "float64[pyarrow]" and not using_nan_is_na :
285
285
# the NaNs are not treated as NA
286
286
exp = exp .copy ()
287
287
if method == "average" :
@@ -406,11 +406,13 @@ def test_rank_dense_method(self, dtype, ser, exp):
406
406
expected = Series (exp ).astype (expected_dtype (dtype , "dense" ))
407
407
tm .assert_series_equal (result , expected )
408
408
409
- def test_rank_descending (self , ser , results , dtype , using_infer_string ):
409
+ def test_rank_descending (
410
+ self , ser , results , dtype , using_infer_string , using_nan_is_na
411
+ ):
410
412
method , _ = results
411
413
if (
412
414
dtype == "int64"
413
- or dtype == "int64[pyarrow]"
415
+ or ( dtype in [ "int64[pyarrow]" ] and not using_nan_is_na )
414
416
or (not using_infer_string and dtype == "str" )
415
417
):
416
418
s = ser .dropna ().astype (dtype )
0 commit comments