Skip to content

Commit

Permalink
FIX-#7088: Make sure rank raises No axis named None... exception (#…
Browse files Browse the repository at this point in the history
…7089)

Signed-off-by: Anatoly Myachev <anatoly.myachev@intel.com>
  • Loading branch information
anmyachev committed Mar 13, 2024
1 parent b2087c4 commit 35226b3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
4 changes: 4 additions & 0 deletions modin/pandas/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2362,6 +2362,10 @@ def rank(
ascending: bool = True,
pct: bool = False,
):
if axis is None:
raise ValueError(
f"No axis named None for object type {type(self).__name__}"
)
axis = self._get_axis_number(axis)
return self.__constructor__(
query_compiler=self._query_compiler.rank(
Expand Down
8 changes: 8 additions & 0 deletions modin/pandas/test/dataframe/test_window.py
Original file line number Diff line number Diff line change
Expand Up @@ -728,6 +728,14 @@ def test_std_var_rank(axis, skipna, method):
)


def test_rank_except():
eval_general(
*create_test_dfs(test_data["float_nan_data"]),
lambda df: df.rank(axis=None),
raising_exceptions=ValueError("No axis named None for object type DataFrame"),
)


@pytest.mark.parametrize("axis", ["rows", "columns"])
@pytest.mark.parametrize("ddof", int_arg_values, ids=arg_keys("ddof", int_arg_keys))
@pytest.mark.parametrize("method", ["std", "var"])
Expand Down

0 comments on commit 35226b3

Please sign in to comment.