Skip to content

Commit 9489446

Browse files
committed
Add test
1 parent 3644ac4 commit 9489446

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Diff for: pandas/tests/series/methods/test_rank.py

+10
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,16 @@ def test_rank_categorical(self):
234234
tm.assert_series_equal(na_ser.rank(na_option="bottom", pct=True), exp_bot)
235235
tm.assert_series_equal(na_ser.rank(na_option="keep", pct=True), exp_keep)
236236

237+
def test_rank_nullable_integer(self):
238+
# GH 56976
239+
exp = Series([np.nan, 2, np.nan, 3, 3, 2, 3, 1])
240+
exp = exp.astype("Int64")
241+
result = exp.rank(na_option="keep")
242+
243+
expected = Series([np.nan, 2.5, np.nan, 5.0, 5.0, 2.5, 5.0, 1.0])
244+
245+
tm.assert_series_equal(result, expected)
246+
237247
def test_rank_signature(self):
238248
s = Series([0, 1])
239249
s.rank(method="average")

0 commit comments

Comments
 (0)