`SimpleImputer().transform` on empty array raises `ValueError: Found array with 0 sample(s)`

### Describe the bug

I understand that the imputer requires at least one sample to fit. There is no reason for it not to return an empty array on `transform` though.

### Steps/Code to Reproduce

```python
import numpy as np
from sklearn.impute import SimpleImputer

X_train = np.array([[1, 2], [np.nan, 3], [7, 6]])
imp = SimpleImputer()
imp.fit(X_train)

X_test = X_train[:0, :]
X_test = imp.transform(X_test)
```

### Expected Results

An empty array of shape `(0, n_features)`.

### Actual Results

```
  File "/cluster/home/lmalte/code/tmp.py", line 10, in <module>
    X_test = imp.transform(X_test)
             ^^^^^^^^^^^^^^^^^^^^^
  File "/cluster/home/lmalte/nobackup/mambaforge/envs/icu/lib/python3.12/site-packages/sklearn/utils/_set_output.py", line 316, in wrapped
    data_to_wrap = f(self, X, *args, **kwargs)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/cluster/home/lmalte/nobackup/mambaforge/envs/icu/lib/python3.12/site-packages/sklearn/impute/_base.py", line 570, in transform
    X = self._validate_input(X, in_fit=False)
        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/cluster/home/lmalte/nobackup/mambaforge/envs/icu/lib/python3.12/site-packages/sklearn/impute/_base.py", line 350, in _validate_input
    raise ve
  File "/cluster/home/lmalte/nobackup/mambaforge/envs/icu/lib/python3.12/site-packages/sklearn/impute/_base.py", line 332, in _validate_input
    X = self._validate_data(
        ^^^^^^^^^^^^^^^^^^^^
  File "/cluster/home/lmalte/nobackup/mambaforge/envs/icu/lib/python3.12/site-packages/sklearn/base.py", line 633, in _validate_data
    out = check_array(X, input_name="X", **check_params)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/cluster/home/lmalte/nobackup/mambaforge/envs/icu/lib/python3.12/site-packages/sklearn/utils/validation.py", line 1087, in check_array
    raise ValueError(
ValueError: Found array with 0 sample(s) (shape=(0, 2)) while a minimum of 1 is required by SimpleImputer.
```

### Versions

```shell
>>> import sklearn; sklearn.show_versions()

System:
    python: 3.12.7 | packaged by conda-forge | (main, Oct  4 2024, 16:05:46) [GCC 13.3.0]
executable: /cluster/home/lmalte/nobackup/mambaforge/envs/icu/bin/python
   machine: Linux-5.15.0-122-generic-x86_64-with-glibc2.35

Python dependencies:
      sklearn: 1.5.2
          pip: 24.3.1
   setuptools: 75.1.0
        numpy: 2.1.2
        scipy: 1.14.1
       Cython: None
       pandas: 2.2.3
   matplotlib: 3.9.2
       joblib: 1.4.2
threadpoolctl: 3.5.0

Built with OpenMP: True

threadpoolctl info:
       user_api: blas
   internal_api: openblas
    num_threads: 4
         prefix: libopenblas
       filepath: /cluster/home/lmalte/nobackup/mambaforge/envs/icu/lib/libopenblasp-r0.3.28.so
        version: 0.3.28
threading_layer: pthreads
   architecture: Haswell

       user_api: openmp
   internal_api: openmp
    num_threads: 4
         prefix: libgomp
       filepath: /cluster/home/lmalte/nobackup/mambaforge/envs/icu/lib/libgomp.so.1.0.0
        version: None
```
```

COMMENT:
I want to investigage how a model on a dataset performs on another dataset from a slightly different distribution. I have a workflow as follows
```python
def load(dataset, outcome, split):
    df = load_dataset(dataset, split)
    y = df[outcome]
    X = df.loc[np.notnan(y), FEATURE_NAMES]
    y = y[np.notnan(y)]

    return X, y

for outcome in OUTCOMES:
    X, y = load(train_dataset, outcome, "train")
    model = Pipeline(...).fit(X, y)
    
    for dataset in DATASETS:
         X, y = load(dataset, outcome, "test")
         yhat = model.predict(X)         
         result = do_something_with(yhat, y)
```
Some `outcome, dataset` combinations are not defined. Currently, I need to add a line
```python
if X.shape[0] == 0:
    continue
```
Not the end of the world. It is just that I would have expected the code to run through during prediction.

Labels: Bug