diff --git a/modin/pandas/base.py b/modin/pandas/base.py index 18607ab4b6a..f9bd05ffff1 100644 --- a/modin/pandas/base.py +++ b/modin/pandas/base.py @@ -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( diff --git a/modin/pandas/test/dataframe/test_window.py b/modin/pandas/test/dataframe/test_window.py index 44caf587491..ae5d83f1e57 100644 --- a/modin/pandas/test/dataframe/test_window.py +++ b/modin/pandas/test/dataframe/test_window.py @@ -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"])