SimpleImputer fails for columns with pandas string type

### Describe the bug

The SimpleImputer class with strategy="most_frequent" fails during fit when one of the columns of the input dataframe is of type string.

The error happens here https://github.com/scikit-learn/scikit-learn/blob/d8e131c1640f13954b2dd5f0cc3b50b82a05a554/sklearn/utils/fixes.py#L58-L59

because (use X from the example below) `np.array(X.iloc[:, 0]) == np.array(X.iloc[:, 0])` returns a bool (`False`) instead of an array of bools.

### Steps/Code to Reproduce

```python
from sklearn.impute import SimpleImputer
import numpy as np
import pandas as pd

X = pd.DataFrame([['A'], ['B'], [np.nan]], dtype="string")
print(X.dtypes)

SimpleImputer(strategy="most_frequent").fit(X)
```

### Expected Results

No errors thrown.



### Actual Results

```
0    string[python]
dtype: object

Traceback (most recent call last):
  File "C:\Users\Mavs\Documents\Python\ATOM\venv310\lib\site-packages\IPython\core\interactiveshell.py", line 3460, in run_code
    exec(code_obj, self.user_global_ns, self.user_ns)
  File "<ipython-input-2-7b70f7e70352>", line 8, in <module>
    SimpleImputer(strategy="most_frequent").fit(X)
  File "C:\Users\Mavs\Documents\Python\ATOM\venv310\lib\site-packages\sklearn\base.py", line 1151, in wrapper
    return fit_method(estimator, *args, **kwargs)
  File "C:\Users\Mavs\Documents\Python\ATOM\venv310\lib\site-packages\sklearn\impute\_base.py", line 405, in fit
    self.statistics_ = self._dense_fit(
  File "C:\Users\Mavs\Documents\Python\ATOM\venv310\lib\site-packages\sklearn\impute\_base.py", line 488, in _dense_fit
    mask = missing_mask.transpose()
AttributeError: 'bool' object has no attribute 'transpose'
```

### Versions

```shell
System:
    python: 3.10.2 (tags/v3.10.2:a58ebcc, Jan 17 2022, 14:12:15) [MSC v.1929 64 bit (AMD64)]
executable: C:\Users\Mavs\Documents\Python\ATOM\venv310\Scripts\python.exe
   machine: Windows-10-10.0.19045-SP0
Python dependencies:
      sklearn: 1.3.0
          pip: 23.2.1
   setuptools: 59.8.0
        numpy: 1.23.5
        scipy: 1.10.1
       Cython: 0.29.30
       pandas: 2.0.3
   matplotlib: 3.7.2
       joblib: 1.3.1
threadpoolctl: 3.1.0
Built with OpenMP: True
threadpoolctl info:
       user_api: openmp
   internal_api: openmp
         prefix: vcomp
       filepath: C:\Users\Mavs\Documents\Python\ATOM\venv310\Lib\site-packages\sklearn\.libs\vcomp140.dll
        version: None
    num_threads: 16
       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: C:\Users\Mavs\Documents\Python\ATOM\venv310\Lib\site-packages\numpy\.libs\libopenblas.FB5AE2TYXYH2IJRDKGDGQ3XBKLKTF43H.gfortran-win_amd64.dll
        version: 0.3.20
threading_layer: pthreads
   architecture: Zen
    num_threads: 16
       user_api: blas
   internal_api: openblas
         prefix: libopenblas
       filepath: C:\Users\Mavs\Documents\Python\ATOM\venv310\Lib\site-packages\scipy.libs\libopenblas-802f9ed1179cb9c9b03d67ff79f48187.dll
        version: 0.3.18
threading_layer: pthreads
   architecture: Zen
    num_threads: 16
```

COMMENT:
Thanks, that worked. A better exception message would be helpful indeed. The issue can be closed.

Labels: Enhancement