Error handling pandas missing values in SimpleImputer

### Describe the bug

I recently installed the stable release of scikit-learn v1.7.2, and noticed that when passing missing_values=pd.NA to the SimpleImputer object, it throws the following error when trying to inspect the object:

TypeError: boolean value of NA is ambiguous

This behavior did not occur in earlier versions such as v1.4.2, where using pd.NA was accepted without issues. I’d like to know if this change is intentional, if there’s a recommended workaround for using pd.NA, or if this is something already being considered for future releases.
Looking forward to your insights or any updates regarding this issue.

### Steps/Code to Reproduce

```py
import pandas as pd
from sklearn.impute import SimpleImputer

# Generar un DataFrame aleatorio con valores faltantes
data = {
    'Categoria': ['A', 'B', pd.NA, 'C', pd.NA],
    'Producto': ['X', pd.NA, 'Y', pd.NA, 'Z']
}
df_random = pd.DataFrame(data)

print("Datos originales con valores faltantes:")
print(df_random)

# Aplicar SimpleImputer para rellenar valores faltantes con 'UNKNOWN'
imputer = SimpleImputer(strategy='constant', fill_value='UNKNOWN', missing_values=pd.NA)
df_imputed = pd.DataFrame(imputer.fit_transform(df_random), columns=df_random.columns)

print("\nDatos después de aplicar SimpleImputer:")
print(df_imputed)

imputer  # <-- crashes
```

### Expected Results

---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
File c:\Users\dca\Documentos\ml\.venv\Lib\site-packages\IPython\core\formatters.py:1036, in MimeBundleFormatter.__call__(self, obj, include, exclude)
   1033     method = get_real_method(obj, self.print_method)
   1035     if method is not None:
-> [1036](file:///C:/Users/dca/Documentos/ml/.venv/Lib/site-packages/IPython/core/formatters.py:1036)         return method(include=include, exclude=exclude)
   1037     return None
   1038 else:

File c:\Users\dca\Documentos\ml\.venv\Lib\site-packages\sklearn\utils\_repr_html\base.py:151, in ReprHTMLMixin._repr_mimebundle_(self, **kwargs)
    149 output = {"text/plain": repr(self)}
    150 if get_config()["display"] == "diagram":
--> [151](file:///C:/Users/dca/Documentos/ml/.venv/Lib/site-packages/sklearn/utils/_repr_html/base.py:151)     output["text/html"] = self._html_repr()
    152 return output

File c:\Users\dca\Documentos\ml\.venv\Lib\site-packages\sklearn\utils\_repr_html\estimator.py:480, in estimator_html_repr(estimator)
    469 html_template = (
    470     f"<style>{style_with_id}</style>"
    471     f"<body>"
   (...)    476     '<div class="sk-container" hidden>'
    477 )
    479 out.write(html_template)
--> [480](file:///C:/Users/dca/Documentos/ml/.venv/Lib/site-packages/sklearn/utils/_repr_html/estimator.py:480) _write_estimator_html(
    481     out,
    482     estimator,
...
   2594     return True

File pandas/_libs/missing.pyx:392, in pandas._libs.missing.NAType.__bool__()

TypeError: boolean value of NA is ambiguous

### Actual Results

File pandas/_libs/missing.pyx:392, in pandas._libs.missing.NAType.__bool__()

TypeError: boolean value of NA is ambiguous

### Versions

```shell
System:
    python: 3.11.4 (tags/v3.11.4:d2340ef, Jun  7 2023, 05:45:37) [MSC v.1934 64 bit (AMD64)]
executable: c:\Users\dca\Documentos\ml\.venv\Scripts\python.exe
   machine: Windows-10-10.0.26100-SP0

Python dependencies:
      sklearn: 1.7.2
          pip: None
   setuptools: 80.9.0
        numpy: 2.3.2
        scipy: 1.16.1
       Cython: None
       pandas: 2.3.2
   matplotlib: 3.10.6
       joblib: 1.5.2
threadpoolctl: 3.6.0

Built with OpenMP: True

threadpoolctl info:
       user_api: blas
   internal_api: openblas
    num_threads: 12
         prefix: libscipy_openblas
       filepath: C:\Users\dca\Documentos\ml\.venv\Lib\site-packages\numpy.libs\libscipy_openblas64_-860d95b1c38e637ce4509f5fa24fbf2a.dll
        version: 0.3.30
threading_layer: pthreads
   architecture: Haswell

       user_api: openmp
   internal_api: openmp
    num_threads: 12
         prefix: vcomp
       filepath: C:\Users\dca\Documentos\ml\.venv\Lib\site-packages\sklearn\.libs\vcomp140.dll
        version: None

       user_api: blas
   internal_api: openblas
    num_threads: 12
         prefix: libscipy_openblas
       filepath: C:\Users\dca\Documentos\ml\.venv\Lib\site-packages\scipy.libs\libscipy_openblas-6b2103f2ae4d8547998b5d188e9801fb.dll
        version: 0.3.28
threading_layer: pthreads
   architecture: Haswell
```

COMMENT:
Hi team,

Thanks for merging the fix! I saw that the issue is now resolved and linked to a PR.
I was wondering:
Will this fix be included in the next release of the scikit-learn library?
If so, do you know which version it will be part of and when it might be released to production?
I’d like to include it in my project’s requirements manager, but I’m not very familiar with how release cycles and branch merges work in large projects like this.
Any guidance would be greatly appreciated.

Thanks in advance!

Labels: Bug