Skip to content

Added a test that breaks over Series.rank with nullable ints #56977

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions pandas/tests/series/methods/test_rank.py
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,23 @@ def test_rank_tie_methods(self, ser, results, dtype):
result = ser.rank(method=method)
tm.assert_series_equal(result, Series(exp))

@pytest.mark.parametrize('dtype', ['Int64', 'UInt64']) #Full set of dtypes not necessary
def test_rank_with_nullable_int(self, dtype, ser, results):
if dtype == 'int64': pytest.skip("Irrelevant dtype for this test.")
method, exp = results
ser = ser.astype(dtype)
result = ser.rank(method=method)
# cast dtype, because pyarrow input leads to different output type
if 'pyarrow' in dtype:
if method == 'average':
exp = Series(exp, dtype='double[pyarrow]')
else:
exp = Series(exp, dtype='uint64[pyarrow]')

else:
exp = Series(exp)
tm.assert_series_equal(result, exp)

@pytest.mark.parametrize("na_option", ["top", "bottom", "keep"])
@pytest.mark.parametrize(
"dtype, na_value, pos_inf, neg_inf",
Expand Down