Repository: pandas-dev/pandas

Issue:
all/any ignoring `bool_only` parameter
#### Code Sample, a copy-pastable example if possible

```python
# Your code here
import pandas as pd
print(pd.DataFrame({"col1": [1,2,3], "col2": [4,5,6], "col3": [None, None, None]}).all(bool_only=True))
print(pd.DataFrame({"col1": [1,2,3], "col2": [4,5,6], "col3": [None, None, None], "col4":[False, False, True]}).all(bool_only=True))
```
#### Problem description

`DataFrame.all` and `DataFrame.any` are both ignoring `bool_only` parameter. It does not seem to matter if there are booleans in the input or not.

This was a regression in 0.24.0. On 0.23.4 it was working, expected output from code sample below.

#### Expected Output

Expected output is:
```python
Series([], dtype: bool)

col4    False
dtype: bool
```

#### Output of ``pd.show_versions()``

<details>

[paste the output of ``pd.show_versions()`` here below this line]
```
INSTALLED VERSIONS
------------------
commit: None
python: 3.6.6.final.0
python-bits: 64
OS: Darwin
OS-release: 16.7.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: en_US.UTF-8

pandas: 0.24.0
pytest: 3.8.2
pip: 18.0
setuptools: 40.4.3
Cython: 0.29
numpy: 1.15.0
scipy: 1.2.0
pyarrow: 0.12.0-RAY
xarray: None
IPython: 7.0.1
sphinx: 1.8.1
patsy: None
dateutil: 2.7.3
pytz: 2018.5
blosc: None
bottleneck: None
tables: None
numexpr: None
feather: 0.4.0
matplotlib: 3.0.0
openpyxl: 2.5.8
xlrd: 1.1.0
xlwt: None
xlsxwriter: None
lxml.etree: 4.2.5
bs4: None
html5lib: None
sqlalchemy: 1.2.17
pymysql: None
psycopg2: None
jinja2: 2.10
s3fs: None
fastparquet: None
pandas_gbq: 0.6.1
pandas_datareader: None
gcsfs: None
```
</details>



Discussion:

Resolving patch:
diff --git a/pandas/core/frame.py b/pandas/core/frame.py
--- a/pandas/core/frame.py
+++ b/pandas/core/frame.py
@@ -7476,7 +7476,8 @@ def f(x):
                 if filter_type is None or filter_type == 'numeric':
                     data = self._get_numeric_data()
                 elif filter_type == 'bool':
-                    data = self
+                    # GH 25101, # GH 24434
+                    data = self._get_bool_data() if axis == 0 else self
                 else:  # pragma: no cover
                     msg = ("Generating numeric_only data with filter_type {f}"
                            "not supported.".format(f=filter_type))


Test patch:
diff --git a/pandas/tests/frame/test_analytics.py b/pandas/tests/frame/test_analytics.py
--- a/pandas/tests/frame/test_analytics.py
+++ b/pandas/tests/frame/test_analytics.py
@@ -1442,6 +1442,26 @@ def test_any_datetime(self):
         expected = Series([True, True, True, False])
         tm.assert_series_equal(result, expected)
 
+    def test_any_all_bool_only(self):
+
+        # GH 25101
+        df = DataFrame({"col1": [1, 2, 3],
+                        "col2": [4, 5, 6],
+                        "col3": [None, None, None]})
+
+        result = df.all(bool_only=True)
+        expected = Series(dtype=np.bool)
+        tm.assert_series_equal(result, expected)
+
+        df = DataFrame({"col1": [1, 2, 3],
+                        "col2": [4, 5, 6],
+                        "col3": [None, None, None],
+                        "col4": [False, False, True]})
+
+        result = df.all(bool_only=True)
+        expected = Series({"col4": False})
+        tm.assert_series_equal(result, expected)
+
     @pytest.mark.parametrize('func, data, expected', [
         (np.any, {}, False),
         (np.all, {}, True),