def factorize(<EOL>self,<EOL>na_sentinel: int = -<NUM_LIT:1>,<EOL>) -> Tuple[np.ndarray, ABCExtensionArray]:
<EOL>from pandas.core.algorithms import _factorize_array<EOL>arr, na_value = self._values_for_factorize()<EOL>labels, uniques = _factorize_array(arr, na_sentinel=na_sentinel,<EOL>na_value=na_value)<EOL>uniques = self._from_factorized(uniques, self)<EOL>return labels, uniques<EOL>
Encode the extension array as an enumerated type.

Parameters
----------
na_sentinel : int, default -1
    Value to use in the `labels` array to indicate missing values.

Returns
-------
labels : ndarray
    An integer NumPy array that's an indexer into the original
    ExtensionArray.
uniques : ExtensionArray
    An ExtensionArray containing the unique values of `self`.

    .. note::

       uniques will *not* contain an entry for the NA value of
       the ExtensionArray if there are any missing values present
       in `self`.

See Also
--------
pandas.factorize : Top-level factorize method that dispatches here.

Notes
-----
:meth:`pandas.factorize` offers a `sort` keyword as well.