Repository: modin-project/modin (python)

Issue:
AttributeError: type object 'DataFrame' has no attribute '__rdivmod__'/'__divmod__'
**Note**: Series has these attributes implemented.

Pull request description:
FEAT-#6784: Add d2p implementations for `DataFrame.__rdivmod__/__divmod__`
<!--
Thank you for your contribution!
Please review the contributing docs: https://modin.readthedocs.io/en/latest/development/contributing.html
if you have questions about contributing.
-->

## What do these changes do?

<!-- Please give a short brief about these changes. -->

- [x] first commit message and PR title follow format outlined [here](https://modin.readthedocs.io/en/latest/development/contributing.html#commit-message-formatting)
  > **_NOTE:_**  If you edit the PR title to match this format, you need to add another commit (even if it's empty) or amend your last commit for the CI job that checks the PR title to pick up the new PR title.
- [x] passes `flake8 modin/ asv_bench/benchmarks scripts/doc_checker.py`
- [x] passes `black --check modin/ asv_bench/benchmarks scripts/doc_checker.py`
- [x] signed commit with `git commit -s` <!-- you can amend your commit with a signature via `git commit -amend -s` -->
- [x] Resolves #6784 <!-- issue must be created for each patch -->
- [x] tests added and passing
- [x] module layout described at `docs/development/architecture.rst` is up-to-date <!-- if you have added, renamed or removed files or directories please update the documentation accordingly -->


Patch:
diff --git a/modin/pandas/dataframe.py b/modin/pandas/dataframe.py
index 2484b393..acba48aa 100644
--- a/modin/pandas/dataframe.py
+++ b/modin/pandas/dataframe.py
@@ -60,6 +60,7 @@ from .iterator import PartitionIterator
 from .series import Series
 from .utils import (
     SET_DATAFRAME_ATTRIBUTE_WARNING,
+    _doc_binary_op,
     cast_function_modin2pandas,
     from_non_pandas,
     from_pandas,
@@ -2720,6 +2721,23 @@ class DataFrame(BasePandasDataset):
             raise KeyError(key)
         self._update_inplace(new_query_compiler=self._query_compiler.delitem(key))
 
+    @_doc_binary_op(
+        operation="integer division and modulo",
+        bin_op="divmod",
+        returns="tuple of two DataFrames",
+    )
+    def __divmod__(self, right):
+        return self._default_to_pandas(pandas.DataFrame.__divmod__, right)
+
+    @_doc_binary_op(
+        operation="integer division and modulo",
+        bin_op="divmod",
+        right="left",
+        returns="tuple of two DataFrames",
+    )
+    def __rdivmod__(self, left):
+        return self._default_to_pandas(pandas.DataFrame.__rdivmod__, left)
+
     __add__ = add
     __iadd__ = add  # pragma: no cover
     __radd__ = radd
diff --git a/modin/pandas/indexing.py b/modin/pandas/indexing.py
index f492278e..fc36b84d 100644
--- a/modin/pandas/indexing.py
+++ b/modin/pandas/indexing.py
@@ -568,6 +568,9 @@ class _LocationIndexerBase(ClassLogger):
         masked_df = self.df.__constructor__(
             query_compiler=self.qc.getitem_array(row_loc._query_compiler)
         )
+        if isinstance(masked_df, Series):
+            assert col_loc == slice(None)
+            return masked_df
         # Passing `slice(None)` as a row indexer since we've just applied it
         return type(self)(masked_df)[(slice(None), col_loc)]
 


Test patch:
diff --git a/modin/pandas/test/dataframe/test_binary.py b/modin/pandas/test/dataframe/test_binary.py
index 62a20d5f..32799189 100644
--- a/modin/pandas/test/dataframe/test_binary.py
+++ b/modin/pandas/test/dataframe/test_binary.py
@@ -90,6 +90,17 @@ def test_math_functions(other, axis, op):
     )
 
 
+@pytest.mark.parametrize("other", [lambda df: 2, lambda df: df])
+def test___divmod__(other):
+    data = test_data["float_nan_data"]
+    eval_general(*create_test_dfs(data), lambda df: divmod(df, other(df)))
+
+
+def test___rdivmod__():
+    data = test_data["float_nan_data"]
+    eval_general(*create_test_dfs(data), lambda df: divmod(2, df))
+
+
 @pytest.mark.parametrize(
     "other",
     [lambda df: df[: -(2**4)], lambda df: df[df.columns[0]].reset_index(drop=True)],
diff --git a/modin/pandas/test/test_series.py b/modin/pandas/test/test_series.py
index e64e1371..8945a356 100644
--- a/modin/pandas/test/test_series.py
+++ b/modin/pandas/test/test_series.py
@@ -2363,6 +2363,14 @@ def test_loc(data):
     df_equals(modin_result, pandas_result)
 
 
+def test_loc_with_boolean_series():
+    modin_series, pandas_series = create_test_series([1, 2, 3])
+    modin_mask, pandas_mask = create_test_series([True, False, False])
+    modin_result = modin_series.loc[modin_mask]
+    pandas_result = pandas_series.loc[pandas_mask]
+    df_equals(modin_result, pandas_result)
+
+
 # This tests the bug from https://github.com/modin-project/modin/issues/3736
 def test_loc_setting_categorical_series():
     modin_series = pd.Series(["a", "b", "c"], dtype="category")