@@ -273,20 +273,20 @@ def test_rank_signature(self):
273
273
with pytest .raises (ValueError , match = msg ):
274
274
s .rank ("average" )
275
275
276
- def test_rank_tie_methods (self , ser , results , dtype , using_infer_string ):
276
+ def test_rank_tie_methods (
277
+ self , ser , results , dtype , using_infer_string , using_nan_is_na
278
+ ):
277
279
method , exp = results
278
280
if (
279
281
dtype == "int64"
280
- or dtype == "int64[pyarrow]"
281
- or dtype == "uint64[pyarrow]"
282
- or dtype == "float64[pyarrow]"
282
+ or (dtype in ["int64[pyarrow]" , "uint64[pyarrow]" ] and not using_nan_is_na )
283
283
or (not using_infer_string and dtype == "str" )
284
284
):
285
285
pytest .skip ("int64/str does not support NaN" )
286
286
287
287
ser = ser if dtype is None else ser .astype (dtype )
288
288
result = ser .rank (method = method )
289
- if dtype == "float64[pyarrow]" :
289
+ if dtype == "float64[pyarrow]" and not using_nan_is_na :
290
290
# the NaNs are not treated as NA
291
291
exp = exp .copy ()
292
292
if method == "average" :
@@ -418,11 +418,13 @@ def test_rank_dense_method(self, dtype, ser, exp):
418
418
expected = Series (exp ).astype (expected_dtype (dtype , "dense" ))
419
419
tm .assert_series_equal (result , expected )
420
420
421
- def test_rank_descending (self , ser , results , dtype , using_infer_string ):
421
+ def test_rank_descending (
422
+ self , ser , results , dtype , using_infer_string , using_nan_is_na
423
+ ):
422
424
method , _ = results
423
425
if (
424
426
dtype == "int64"
425
- or dtype == "int64[pyarrow]"
427
+ or ( dtype in [ "int64[pyarrow]" ] and not using_nan_is_na )
426
428
or (not using_infer_string and dtype == "str" )
427
429
):
428
430
s = ser .dropna ().astype (dtype )
0 commit comments