Skip to content

Commit b9c4454

Browse files
update frame tests
1 parent 5aae560 commit b9c4454

File tree

1 file changed

+4
-19
lines changed

1 file changed

+4
-19
lines changed

pandas/tests/frame/methods/test_rank.py

Lines changed: 4 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,11 @@
66
import numpy as np
77
import pytest
88

9-
from pandas._config import using_string_dtype
10-
119
from pandas._libs.algos import (
1210
Infinity,
1311
NegInfinity,
1412
)
15-
from pandas.compat import HAS_PYARROW
1613

17-
import pandas as pd
1814
from pandas import (
1915
DataFrame,
2016
Index,
@@ -467,23 +463,10 @@ def test_rank_inf_nans_na_option(
467463
("top", False, [2.0, 3.0, 1.0, 4.0]),
468464
],
469465
)
470-
def test_rank_object_first(
471-
self,
472-
request,
473-
frame_or_series,
474-
na_option,
475-
ascending,
476-
expected,
477-
using_infer_string,
478-
):
466+
def test_rank_object_first(self, frame_or_series, na_option, ascending, expected):
479467
obj = frame_or_series(["foo", "foo", None, "foo"])
480-
if using_string_dtype() and not HAS_PYARROW and isinstance(obj, Series):
481-
request.applymarker(pytest.mark.xfail(reason="TODO(infer_string)"))
482-
483468
result = obj.rank(method="first", na_option=na_option, ascending=ascending)
484469
expected = frame_or_series(expected)
485-
if using_infer_string and isinstance(obj, Series):
486-
expected = expected.astype("uint64")
487470
tm.assert_equal(result, expected)
488471

489472
@pytest.mark.parametrize(
@@ -507,7 +490,9 @@ def test_rank_string_dtype(self, string_dtype_no_object):
507490
# GH#55362
508491
obj = Series(["foo", "foo", None, "foo"], dtype=string_dtype_no_object)
509492
result = obj.rank(method="first")
510-
exp_dtype = "Int64" if string_dtype_no_object.na_value is pd.NA else "float64"
493+
exp_dtype = (
494+
"Float64" if string_dtype_no_object == "string[pyarrow]" else "float64"
495+
)
511496
if string_dtype_no_object.storage == "python":
512497
# TODO nullable string[python] should also return nullable Int64
513498
exp_dtype = "float64"

0 commit comments

Comments
 (0)