pandas.api.extensions.ExtensionArray.factorize¶
-
ExtensionArray.
factorize
(na_sentinel: int = - 1) → Tuple[numpy.ndarray, pandas.core.dtypes.generic.ABCExtensionArray][source]¶ Encode the extension array as an enumerated type.
- Parameters
- na_sentinelint, default -1
Value to use in the labels array to indicate missing values.
- Returns
- labelsndarray
An integer NumPy array that’s an indexer into the original ExtensionArray.
- uniquesExtensionArray
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
factorize
Top-level factorize method that dispatches here.
Notes
pandas.factorize()
offers a sort keyword as well.