title: Scikit-learn: AttributeError: 'bool' object has no attribute 'any'
body: <p>So, I was working on a pipeline, and I stumbled upon this error when fitting it:</p>
  <pre><code>Traceback (most recent call last):
    File &quot;C:/Users/Shawn/Documents/temp/bool_issue.py&quot;, line 7, in &lt;module&gt;
      _assert_all_finite(array, False)
    File &quot;C:\Users\Shawn\AppData\Local\Programs\Python\Python38\lib\site-packages\sklearn\utils\validation.py&quot;, line 103, in _assert_all_finite
      if _object_dtype_isnan(X).any():
  AttributeError: 'bool' object has no attribute 'any'
  </code></pre>
  <p><em>This is actually a some custom code to test the issue, see below</em></p>
  <p>Following the traceback, I see that <code>_object_dtype_isnan()</code> takes a numpy array, and returns another numpy array, in the form of a boolean mask (an array of booleans).<br />
  However, for some reason, it sometimes returns a boolean directly instead.</p>
  <p>Code to reproduce the error:</p>
  <pre class="lang-py prettyprint-override"><code>import numpy as np
  import pandas as pd
  from sklearn.utils.validation import _assert_all_finite
  
  bad_array = np.array(['F', 'F', 'M', 'F', 'M', pd.NA, 'F', 'M'], dtype='object')
  
  _assert_all_finite(bad_array, False)  # Raises AttributeError
  </code></pre>