Make RFE/RFECV preserve pandas dataframes

### Describe the workflow you want to enable

Hi!

I am currently using xgboost with some categorical features. To get that to work the categorical features have to be marked as such in the pandas dataframe:
```python
df["my_cats"] = df["my_cats"].astype("string").astype("category")
```

The RFE(CV) implementation converts any input to a numpy array that can only contain numeric values which blocks me from using them with xgboost because the dtype information get's lost along the way.

So my proposal: make RFE and RFECV preserve pandas dataframes so the estimator that is used still has access to this information.


### Describe your proposed solution

I was able to get this to work with the following quick-and-dirty changes:
```python
# relax the data validation a little bit (dtype -> None, cast_to_ndarray -> False)
X, y = self._validate_data(
    X,
    y,
    accept_sparse="csc",
    ensure_min_features=2,
    force_all_finite=False,
    multi_output=True,
    dtype=None,
    cast_to_ndarray=False,
)

# make the fit command pandas compliant
estimator.fit(X.iloc[:, features], y, **fit_params)

# instead of
estimator.fit(X[:, features], y, **fit_params)
```
The second step is a hack of course and would have to be replaced depending on the input of X.

With these changes and a `set_output(transform='pandas')` i got the optimization to work.

### Describe alternatives you've considered, if relevant

_No response_

### Additional context

https://github.com/scikit-learn/scikit-learn/issues/17338 - similar problem with catboost.

COMMENT:
+1. I came here to post a separate issue, but will add here instead as I suspect same root cause and will be solved together.

Setup:

```python
from sklearn.datasets import load_iris
import sklearn.linear_model
import sklearn.feature_selection
import sklearn.model_selection
import sklearn.tree

iris = load_iris(as_frame=True)
X = iris['data']
y = iris['target']

X_train, X_test, y_train, y_test = sklearn.model_selection.train_test_split(X, y, test_size=30)

from sklearn import set_config
set_config(transform_output = "pandas")
```

Normal use of DecisionTreeClassifier (or any classifier) - works fine:

```python
clf = sklearn.tree.DecisionTreeClassifier()

clf.fit(X_train,y_train)
print(clf.predict(X_test))
print(clf.feature_names_in_)
```
```
[1 1 0 0 1 1 2 0 0 2 2 2 2 1 1 1 2 1 1 0 2 1 1 1 0 1 2 2 1 2]
['sepal length (cm)' 'sepal width (cm)' 'petal length (cm)' 'petal width (cm)']
```


but using RFE to fit a DecisionTreeClassifier complains about feature names:
- not just DecisionTreeClassifier - other models also - the issue is with RFE
- not just RFE, also RFECV
```python
clf = sklearn.feature_selection.RFE(
        estimator=sklearn.tree.DecisionTreeClassifier(),
        # estimator=sklearn.linear_model.LogisticRegression(),
        n_features_to_select=2
        ).set_output(transform='pandas')

clf.fit(X_train,y_train)
print(clf.transform(X_test)[:1])
print(clf.predict(X_test))
print(clf.feature_names_in_)
print(clf.estimator_.feature_names_in_)
```
```
    petal length (cm)  petal width (cm)
85                4.5               1.6
[1 1 0 0 1 1 2 0 0 2 2 2 2 1 1 1 2 1 1 0 2 1 1 1 0 1 2 2 1 2]
['sepal length (cm)' 'sepal width (cm)' 'petal length (cm)'
 'petal width (cm)']
... /sklearn/base.py:486: UserWarning: X has feature names, but DecisionTreeClassifier was fitted without feature names
  warnings.warn(
AttributeError: 'DecisionTreeClassifier' object has no attribute 'feature_names_in_'
```

It shouldn't complain "UserWarning: X has feature names, but DecisionTreeClassifier was fitted without feature names". `clf.fit` and `clf.predict` were both run on dataframes with feature names.

In a nutshell, RFE and RFECV implement both transform and predict. Transform returns X after feature selection; and predict does the transform and then uses the fitted estimator to predict. The above cell output shows that transform retains feature names, the output is a dataframe like the input. However predict complains about feature names, because when RFE(CV) fits the estimator it does so without feature names. And `feature_names_in_` works for the RFE but not for the estimator, for the same reason.

Labels: New Feature