preprocesor gives a Value Error when using Simple Imputer + StandardScaler in Pipeline (reopened issue)

### Describe the bug

I get a ValueError when using classifier.predict with a variable that has been preprocesse diwht a ColumnTransofrmer that uses SimpleIMputer+StandardScaler with numerical var and OneHotEncoder with categorical var.

```
base.py:457: UserWarning: X has feature names, but LogisticRegression was fitted without feature names
  warnings.warn(
anaconda3\Lib\site-packages\pandas\core\generic.py in ?(self, dtype)
   1996     def __array__(self, dtype: npt.DTypeLike | None = None) -> np.ndarray:
   1997         values = self._values
-> 1998         arr = np.asarray(values, dtype=dtype)
   1999         if (
   2000             astype_is_view(values.dtype, arr.dtype)
   2001             and using_copy_on_write()

ValueError: could not convert string to float: 'High School'
```

### Steps/Code to Reproduce

```
X2 = loan dataframe
y = target variable (loan approved)
X2_train, X2_test, y2_train, y2_test = train_test_split(X2,y2, test_size = 0.20, random_state = 0)


numeric_transformer = Pipeline(steps = [("imputer", SimpleImputer(strategy="mean")),
                                       ("scaler", StandardScaler())
                                       ])
categorical_transformer = OneHotEncoder(drop = "first") 

preprocessor = ColumnTransformer(
            transformers = [("numerical", numeric_transformer, numeric_features), 
                            ("categorical", categorical_transformer, categorical_features)]
)
preprocessor
X2_train = preprocessor.fit_transform(X2_train)
X2_test = preprocessor.transform(X2_test)

```

### Expected Results

No error thrown, and X2 and y ready to use a LogisticRegression() as classifier

### Actual Results

```
base.py:457: UserWarning: X has feature names, but LogisticRegression was fitted without feature names
  warnings.warn(
anaconda3\Lib\site-packages\pandas\core\generic.py in ?(self, dtype)
   1996     def __array__(self, dtype: npt.DTypeLike | None = None) -> np.ndarray:
   1997         values = self._values
-> 1998         arr = np.asarray(values, dtype=dtype)
   1999         if (
   2000             astype_is_view(values.dtype, arr.dtype)
   2001             and using_copy_on_write()

ValueError: could not convert string to float: 'High School'
```

### Versions

```shell
Python 3.11.5
Windows 10-10.0.22.631
sklearn: 1.3.0
scipy 1.11.1
pandas 2.0.3
numpy 1.24.3
Built with OpenMP
```

COMMENT:
I have tried to specify the columns by number and I get a different error

```
numeric_features2 = X2.iloc[:,:8]
categorical_features2 = X2.iloc[:, 8:16]
preprocessor = ColumnTransformer(
            transformers = [("numerical", numeric_transformer, numeric_features2), 
                            ("categorical", categorical_transformer, categorical_features2)]
)
X2_train = preprocessor.fit_transform(X2_train)
X2_test = preprocessor.transform(X2_test)

```


ERROR:
_set_output.py:140, in _wrap_method_output.<locals>.wrapped(self, X, *args, **kwargs)

File ~\anaconda3\Lib\site-packages\sklearn\utils\__init__.py:281, in _determine_key_type(key, accept_slice)
    279     except KeyError:
    280         raise ValueError(err_msg)
--> 281 raise ValueError(err_msg)

ValueError: No valid specification of the columns. Only a scalar, list or slice of all integers or all strings, or boolean mask is allowed
1
X2_train

Labels: Bug, Needs Triage