We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 203431e commit 29377a5Copy full SHA for 29377a5
pandas/tests/groupby/test_rank.py
@@ -13,6 +13,23 @@
13
import pandas._testing as tm
14
15
16
+def test_rank_unordered_categorical_typeerror():
17
+ # GH#51034 should be TypeError, not NotImplementedError
18
+ cat = pd.Categorical([], ordered=False)
19
+ ser = Series(cat)
20
+ df = ser.to_frame()
21
+
22
+ msg = "Cannot perform rank with non-ordered Categorical"
23
24
+ gb = ser.groupby(cat)
25
+ with pytest.raises(TypeError, match=msg):
26
+ gb.rank()
27
28
+ gb2 = df.groupby(cat)
29
30
+ gb2.rank()
31
32
33
def test_rank_apply():
34
lev1 = tm.rands_array(10, 100)
35
lev2 = tm.rands_array(10, 130)
0 commit comments