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