Repository: modin-project/modin

Issue:
Fix functions with `bool_only` arguments
### Describe the problem
When `bool_only=True` for `all` and `any` (the only functions that take in the `bool_only` argument), modin throws a `ValueError`

### Source code / logs
```
import modin.pandas as pd
data = {
        "col1": 1.0,
        "col2": np.datetime64("2011-06-15T00:00"),
        "col3": np.array([3] * 4, dtype="int32"),
        "col4": "foo",
        "col5": True,
}
modin_df = pd.DataFrame(data)
modin_df.any(bool_only=True)
```
Throws the following error:
```ValueError: Length mismatch: Expected axis has 1 elements, new values have 5 elements```



Discussion:

Resolving patch:
diff --git a/modin/data_management/data_manager.py b/modin/data_management/data_manager.py
--- a/modin/data_management/data_manager.py
+++ b/modin/data_management/data_manager.py
@@ -1108,21 +1108,40 @@ def all(self, **kwargs):
         """Returns whether all the elements are true, potentially over an axis.
 
         Return:
-            Pandas Series containing boolean values.
+            Pandas Series containing boolean values or boolean.
         """
-        axis = kwargs.get("axis", 0)
-        func = self._prepare_method(pandas.DataFrame.all, **kwargs)
-        return self.full_axis_reduce(func, axis)
+        return self._process_all_any(pandas.DataFrame.all, **kwargs)
 
     def any(self, **kwargs):
-        """Returns whether any element is true over the requested axis.
+        """Returns whether any the elements are true, potentially over an axis.
+
+        Return:
+            Pandas Series containing boolean values or boolean.
+        """
+        return self._process_all_any(pandas.DataFrame.any, **kwargs)
+
+    def _process_all_any(self, func, **kwargs):
+        """Calculates if any or all the values are true.
 
         Return:
-            Pandas Series containing boolean values.
+            Pandas Series containing boolean values or boolean.
         """
         axis = kwargs.get("axis", 0)
-        func = self._prepare_method(pandas.DataFrame.any, **kwargs)
-        return self.full_axis_reduce(func, axis)
+        bool_only = kwargs.get("bool_only", None)
+        index = self.index if axis else self.columns
+        if bool_only:
+            not_bool = []
+            for index, dtype in zip(index, self.dtypes):
+                if dtype != bool:
+                    not_bool.append(index)
+            if axis:
+                data_manager = self.drop(index=not_bool)
+            else:
+                data_manager = self.drop(columns=not_bool)
+        else:
+            data_manager = self
+        func = data_manager._prepare_method(func, **kwargs)
+        return data_manager.full_axis_reduce(func, axis)
 
     def first_valid_index(self):
         """Returns index of first non-NaN/NULL value.
diff --git a/modin/pandas/dataframe.py b/modin/pandas/dataframe.py
--- a/modin/pandas/dataframe.py
+++ b/modin/pandas/dataframe.py
@@ -650,7 +650,6 @@ def all(self, axis=0, bool_only=None, skipna=None, level=None, **kwargs):
             axis = pandas.DataFrame()._get_axis_number(axis)
         else:
             axis = None
-
         result = self._data_manager.all(
             axis=axis, bool_only=bool_only, skipna=skipna, level=level, **kwargs
         )
@@ -659,18 +658,24 @@ def all(self, axis=0, bool_only=None, skipna=None, level=None, **kwargs):
         else:
             return result.all()
 
-    def any(self, axis=None, bool_only=None, skipna=None, level=None, **kwargs):
+    def any(self, axis=0, bool_only=None, skipna=None, level=None, **kwargs):
         """Return whether any elements are True over requested axis
 
         Note:
             If axis=None or axis=0, this call applies on the column partitions,
                 otherwise operates on row partitions
         """
-        axis = pandas.DataFrame()._get_axis_number(axis) if axis is not None else 0
-
-        return self._data_manager.any(
+        if axis is not None:
+            axis = pandas.DataFrame()._get_axis_number(axis)
+        else:
+            axis = None
+        result = self._data_manager.any(
             axis=axis, bool_only=bool_only, skipna=skipna, level=level, **kwargs
         )
+        if axis is not None:
+            return result
+        else:
+            return result.any()
 
     def append(self, other, ignore_index=False, verify_integrity=False, sort=None):
         """Append another DataFrame/list/Series to this one.


Test patch: