(data)
| 9540 | raise ValueError(msg) |
| 9541 | |
| 9542 | def ranker(data): |
| 9543 | if data.ndim == 2: |
| 9544 | # i.e. DataFrame, we cast to ndarray |
| 9545 | values = data.values |
| 9546 | else: |
| 9547 | # i.e. Series, can dispatch to EA |
| 9548 | values = data._values |
| 9549 | |
| 9550 | if isinstance(values, ExtensionArray): |
| 9551 | ranks = values._rank( |
| 9552 | axis=axis_int, |
| 9553 | method=method, |
| 9554 | ascending=ascending, |
| 9555 | na_option=na_option, |
| 9556 | pct=pct, |
| 9557 | ) |
| 9558 | else: |
| 9559 | ranks = algos.rank( |
| 9560 | values, |
| 9561 | axis=axis_int, |
| 9562 | method=method, |
| 9563 | ascending=ascending, |
| 9564 | na_option=na_option, |
| 9565 | pct=pct, |
| 9566 | ) |
| 9567 | |
| 9568 | ranks_obj = self._constructor(ranks, **data._construct_axes_dict()) |
| 9569 | return ranks_obj.__finalize__(self, method="rank") |
| 9570 | |
| 9571 | if numeric_only: |
| 9572 | if self.ndim == 1 and not is_numeric_dtype(self.dtype): |
nothing calls this directly
no test coverage detected