File tree Expand file tree Collapse file tree 1 file changed +28
-12
lines changed Expand file tree Collapse file tree 1 file changed +28
-12
lines changed Original file line number Diff line number Diff line change @@ -9286,14 +9286,24 @@ def ranker(blk_values):
9286
9286
pct = pct ,
9287
9287
)
9288
9288
else :
9289
- ranks = algos .rank (
9290
- blk_values .T ,
9291
- axis = axis_int ,
9292
- method = method ,
9293
- ascending = ascending ,
9294
- na_option = na_option ,
9295
- pct = pct ,
9296
- ).T
9289
+ if blk_values .ndim > 1 and axis_int == 0 :
9290
+ ranks = algos .rank (
9291
+ blk_values .T ,
9292
+ axis = axis_int ,
9293
+ method = method ,
9294
+ ascending = ascending ,
9295
+ na_option = na_option ,
9296
+ pct = pct ,
9297
+ ).T
9298
+ else :
9299
+ ranks = algos .rank (
9300
+ blk_values ,
9301
+ axis = axis_int ,
9302
+ method = method ,
9303
+ ascending = ascending ,
9304
+ na_option = na_option ,
9305
+ pct = pct ,
9306
+ )
9297
9307
return ranks
9298
9308
9299
9309
if numeric_only :
@@ -9307,10 +9317,16 @@ def ranker(blk_values):
9307
9317
else :
9308
9318
data = self
9309
9319
9310
- result = data ._mgr .apply (ranker )
9311
- return self ._constructor_from_mgr (result , axes = result .axes ).__finalize__ (
9312
- self , method = "rank"
9313
- )
9320
+ should_transpose = data .ndim > 1 and axis_int == 1
9321
+
9322
+ if should_transpose :
9323
+ data = data .T
9324
+ applied = data ._mgr .apply (ranker )
9325
+ result = self ._constructor_from_mgr (applied , axes = applied .axes )
9326
+ if should_transpose :
9327
+ result = result .T
9328
+
9329
+ return result .__finalize__ (self , method = "rank" )
9314
9330
9315
9331
@doc (_shared_docs ["compare" ], klass = _shared_doc_kwargs ["klass" ])
9316
9332
def compare (
You can’t perform that action at this time.
0 commit comments