Skip to content
38 changes: 9 additions & 29 deletions pandas/core/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@

import decimal
import operator
from textwrap import dedent
from typing import (
TYPE_CHECKING,
Literal,
Expand Down Expand Up @@ -35,10 +34,7 @@
TakeIndexer,
npt,
)
from pandas.util._decorators import (
doc,
set_module,
)
from pandas.util._decorators import set_module
from pandas.util._exceptions import find_stack_level

from pandas.core.dtypes.cast import (
Expand Down Expand Up @@ -654,28 +650,6 @@ def factorize_array(


@set_module("pandas")
@doc(
values=dedent(
"""\
values : sequence
A 1-D sequence. Sequences that aren't pandas objects are
coerced to ndarrays before factorization.
"""
),
sort=dedent(
"""\
sort : bool, default False
Sort `uniques` and shuffle `codes` to maintain the
relationship.
"""
),
size_hint=dedent(
"""\
size_hint : int, optional
Hint to the hashtable sizer.
"""
),
)
def factorize(
values,
sort: bool = False,
Expand All @@ -692,12 +666,18 @@ def factorize(

Parameters
----------
{values}{sort}
values : sequence
A 1-D sequence. Sequences that aren't pandas objects are
coerced to ndarrays before factorization.
sort : bool, default False
Sort `uniques` and shuffle `codes` to maintain the
relationship.
use_na_sentinel : bool, default True
If True, the sentinel -1 will be used for NaN values. If False,
NaN values will be encoded as non-negative integers and will not drop the
NaN from the uniques of the values.
{size_hint}\
size_hint : int, optional
Hint to the hashtable sizer.

Returns
-------
Expand Down
Loading