Clarification and Improvement Suggestions for OrdinalEncoder Input and Output

### Describe the workflow you want to enable


Hi there,

I'm relatively new to working with scikit-learn, and as I delve into it, a couple of aspects of the `OrdinalEncoder` have raised questions for me regarding its functionality and design. I'd appreciate some insights and perhaps a bit of clarification:

1) The output structure of `encoder.categories_` appears as a list of arrays. While I understand this design choice may have its reasons, I find it less intuitive for visualization and exploration purposes. Is there a specific rationale for this structure, and do you have any recommendations or best practices for making the output more user-friendly for visual checks?

```python3
from sklearn.preprocessing import OrdinalEncoder
encoder = OrdinalEncoder()
print(encoder.categories_)
```
the result is:
```python3
[array(el_1, ..., el_n), array...]
```

2) I came across a mention of `encoder.set_output()` in your documentation. It seems to take a single parameter (transform='pandas') to set the output type of the encoder function. Could you provide more details or examples on how this method functions and any additional parameters it might accept?

```python3
from sklearn.preprocessing import OrdinalEncoder
encoder = OrdinalEncoder()
encoder.set_output(transform='pandas')
```


### Describe your proposed solution

1)  It would be more intuitive if the output of `encoder.categories_` were presented as a dictionary mapper, like the following:
```python3
[{key_1:val_1, ..., key_n:val_n}, {key: val...}]
```

Alternatively, providing the option for output as a DataFrame, as demonstrated in the following function:

```python3
def find_mapper(df, enc):
    tmp = df.copy()
    tmp['encoded'] = enc.fit_transform(tmp)
    tmp.drop_duplicates(inplace=True)
    tmp.sort_values('encoded', inplace=True)
    tmp.reset_index(inplace=True)
    tmp.drop(columns=['index'], inplace=True)
    print(tmp)

find_mapper(df=education_col, enc=encoder)

        education  encoded
0            10th      0.0
1            11th      1.0
2            12th      2.0
3         1st-4th      3.0
4         5th-6th      4.0
5         7th-8th      5.0
6             9th      6.0
7      Assoc-acdm      7.0
8       Assoc-voc      8.0
9       Bachelors      9.0
10      Doctorate     10.0
11        HS-grad     11.0
12        Masters     12.0
13      Preschool     13.0
14    Prof-school     14.0
15   Some-college     15.0
```

2)  It would be beneficial if the output format could be defined directly in the main input function, enhancing ease of use. For example:

```python3
encoder = OrdinalEncoder(set_output='pandas')
```

I believe these enhancements could contribute to a more user-friendly experience with OrdinalEncoder. Your consideration and feedback on these suggestions would be greatly appreciated.

Thank you!

### Describe alternatives you've considered, if relevant

_No response_

### Additional context

_No response_

COMMENT:
Thanks for the issue. In the future, please open two separate issues in a case like this one.

As for your second question, this is the API we have settled on, and we might be allowing to set the output type for methods other than `transform`. And since we didn't want to modify every estimator's constructor, we have opted not to have it as a constructor parameter.

Labels: New Feature