Closed
Description
Looks like it is discarding the axis=1
df = DataFrame({0: [1, 3, 5, 7], 1: [2, 4, 6, 8], 2: [1.5, 3.5, 5.5, 7.5]}, index=["a", "a", "b", "b"])
gb = df.groupby(level=0, axis=0)
res = gb.rank(axis=1)
# This should match what we get when "manually" operating group-by-group
expected = concat([df.loc["a"].rank(axis=1), df.loc["b"].rank(axis=1)], axis=0)
>>> res
0 1 2
a 1.0 1.0 1.0
a 2.0 2.0 2.0
b 1.0 1.0 1.0
b 2.0 2.0 2.0
>>> expected
0 1 2
a 1.0 3.0 2.0
a 1.0 3.0 2.0
b 1.0 3.0 2.0
b 1.0 3.0 2.0