LabelBinarizer() throws TypeError: '<' not supported between instances of 'str' and 'float'

### Describe the bug

As I understand it, LabelBinarizer is meant to have a categorical string as an input. I input a y dependent variable as a categorical of dtype "category" with values "apple", "orange", or "pear":

```
y = np.array(["apple", "apple", "orange", "pear"])

y_dense = LabelBinarizer().fit_transform(y)
```

yet it throws an error as below, seemingly when it attempts to sort the values. Is this expected behavior?

### Steps/Code to Reproduce

```
y = np.array(["apple", "apple", "orange", "pear"])

y_dense = LabelBinarizer().fit_transform(y)
```

### Expected Results

Label Binarizer to encode as a matrix.

### Actual Results

```
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[283], line 5
      2 from sklearn.preprocessing import LabelBinarizer
      4 y = np.array(rain_multi_dir["WindGustDir"].values)
----> 5 y_dense = LabelBinarizer().fit_transform(y)
      6 y_dense

File [~\Languages\Lib\site-packages\sklearn\preprocessing\_label.py:329](http://localhost:8888/lab/tree/rainfall_aus/~/Languages/Lib/site-packages/sklearn/preprocessing/_label.py#line=328), in LabelBinarizer.fit_transform(self, y)
    309 def fit_transform(self, y):
    310     """Fit label binarizer/transform multi-class labels to binary labels.
    311 
    312     The output of transform is sometimes referred to as
   (...)
    327         will be of CSR format.
    328     """
--> 329     return self.fit(y).transform(y)

File [~\Languages\Lib\site-packages\sklearn\base.py:1473](http://localhost:8888/lab/tree/rainfall_aus/~/Languages/Lib/site-packages/sklearn/base.py#line=1472), in _fit_context.<locals>.decorator.<locals>.wrapper(estimator, *args, **kwargs)
   1466     estimator._validate_params()
   1468 with config_context(
   1469     skip_parameter_validation=(
   1470         prefer_skip_nested_validation or global_skip_validation
   1471     )
   1472 ):
-> 1473     return fit_method(estimator, *args, **kwargs)

File [~\Languages\Lib\site-packages\sklearn\preprocessing\_label.py:296](http://localhost:8888/lab/tree/rainfall_aus/~/Languages/Lib/site-packages/sklearn/preprocessing/_label.py#line=295), in LabelBinarizer.fit(self, y)
    289 if self.sparse_output and (self.pos_label == 0 or self.neg_label != 0):
    290     raise ValueError(
    291         "Sparse binarization is only supported with non "
    292         "zero pos_label and zero neg_label, got "
    293         f"pos_label={self.pos_label} and neg_label={self.neg_label}"
    294     )
--> 296 self.y_type_ = type_of_target(y, input_name="y")
    298 if "multioutput" in self.y_type_:
    299     raise ValueError(
    300         "Multioutput target data is not supported with label binarization"
    301     )

File [~\Languages\Lib\site-packages\sklearn\utils\multiclass.py:404](http://localhost:8888/lab/tree/rainfall_aus/~/Languages/Lib/site-packages/sklearn/utils/multiclass.py#line=403), in type_of_target(y, input_name)
    402 if issparse(first_row_or_val):
    403     first_row_or_val = first_row_or_val.data
--> 404 if xp.unique_values(y).shape[0] > 2 or (y.ndim == 2 and len(first_row_or_val) > 1):
    405     # [1, 2, 3] or [[1., 2., 3]] or [[1, 2]]
    406     return "multiclass" + suffix
    407 else:

File [~\Languages\Lib\site-packages\sklearn\utils\_array_api.py:407](http://localhost:8888/lab/tree/rainfall_aus/~/Languages/Lib/site-packages/sklearn/utils/_array_api.py#line=406), in _NumPyAPIWrapper.unique_values(self, x)
    406 def unique_values(self, x):
--> 407     return numpy.unique(x)

File [~\Languages\Lib\site-packages\numpy\lib\_arraysetops_impl.py:289](http://localhost:8888/lab/tree/rainfall_aus/~/Languages/Lib/site-packages/numpy/lib/_arraysetops_impl.py#line=288), in unique(ar, return_index, return_inverse, return_counts, axis, equal_nan)
    287 ar = np.asanyarray(ar)
    288 if axis is None:
--> 289     ret = _unique1d(ar, return_index, return_inverse, return_counts, 
    290                     equal_nan=equal_nan, inverse_shape=ar.shape, axis=None)
    291     return _unpack_tuple(ret)
    293 # axis was specified and not None

File [~\Languages\Lib\site-packages\numpy\lib\_arraysetops_impl.py:356](http://localhost:8888/lab/tree/rainfall_aus/~/Languages/Lib/site-packages/numpy/lib/_arraysetops_impl.py#line=355), in _unique1d(ar, return_index, return_inverse, return_counts, equal_nan, inverse_shape, axis)
    354     aux = ar[perm]
    355 else:
--> 356     ar.sort()
    357     aux = ar
    358 mask = np.empty(aux.shape, dtype=np.bool)

TypeError: '<' not supported between instances of 'str' and 'float'
```

### Versions

```shell
System:
    python: 3.12.6 (tags/v3.12.6:a4a2d2b, Sep  6 2024, 20:11:23) [MSC v.1940 64 bit (AMD64)]
executable: C:\Users\benno\Languages\python.exe
   machine: Windows-10-10.0.19045-SP0

Python dependencies:
      sklearn: 1.5.2
          pip: 24.2
   setuptools: 75.1.0
        numpy: 2.0.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: libscipy_openblas
       filepath: C:\Users\benno\Languages\Lib\site-packages\numpy.libs\libscipy_openblas64_-caad452230ae4ddb57899b8b3a33c55c.dll
        version: 0.3.27
threading_layer: pthreads
   architecture: Haswell

       user_api: openmp
   internal_api: openmp
    num_threads: 4
         prefix: vcomp
       filepath: C:\Users\benno\Languages\Lib\site-packages\sklearn\.libs\vcomp140.dll
        version: None

       user_api: blas
   internal_api: openblas
    num_threads: 4
         prefix: libscipy_openblas
       filepath: C:\Users\benno\Languages\Lib\site-packages\scipy.libs\libscipy_openblas-5b1ec8b915dfb81d11cebc0788069d2d.dll
        version: 0.3.27.dev
threading_layer: pthreads
   architecture: Haswell
```

COMMENT:
marking as closed

Labels: Bug, Needs Triage