@@ -698,7 +698,7 @@ def factorize(
698698 NaN values will be encoded as non-negative integers and will not drop the
699699 NaN from the uniques of the values.
700700
701- {size_hint}\
701+ {size_hint}
702702
703703 Returns
704704 -------
@@ -730,7 +730,7 @@ def factorize(
730730 ``pd.factorize(values)``. The results are identical for methods like
731731 :meth:`Series.factorize`.
732732
733- >>> codes, uniques = pd.factorize(np.array(['b', 'b', 'a', 'c', 'b' ], dtype="O"))
733+ >>> codes, uniques = pd.factorize(np.array(["b", "b", "a", "c", "b" ], dtype="O"))
734734 >>> codes
735735 array([0, 0, 1, 2, 0])
736736 >>> uniques
@@ -739,8 +739,9 @@ def factorize(
739739 With ``sort=True``, the `uniques` will be sorted, and `codes` will be
740740 shuffled so that the relationship is the maintained.
741741
742- >>> codes, uniques = pd.factorize(np.array(['b', 'b', 'a', 'c', 'b'], dtype="O"),
743- ... sort=True)
742+ >>> codes, uniques = pd.factorize(
743+ ... np.array(["b", "b", "a", "c", "b"], dtype="O"), sort=True
744+ ... )
744745 >>> codes
745746 array([1, 1, 0, 2, 1])
746747 >>> uniques
@@ -750,7 +751,7 @@ def factorize(
750751 the `codes` with the sentinel value ``-1`` and missing values are not
751752 included in `uniques`.
752753
753- >>> codes, uniques = pd.factorize(np.array(['b' , None, 'a', 'c', 'b' ], dtype="O"))
754+ >>> codes, uniques = pd.factorize(np.array(["b" , None, "a", "c", "b" ], dtype="O"))
754755 >>> codes
755756 array([ 0, -1, 1, 2, 0])
756757 >>> uniques
@@ -760,7 +761,7 @@ def factorize(
760761 NumPy arrays). When factorizing pandas objects, the type of `uniques`
761762 will differ. For Categoricals, a `Categorical` is returned.
762763
763- >>> cat = pd.Categorical(['a', 'a', 'c' ], categories=['a', 'b', 'c' ])
764+ >>> cat = pd.Categorical(["a", "a", "c" ], categories=["a", "b", "c" ])
764765 >>> codes, uniques = pd.factorize(cat)
765766 >>> codes
766767 array([0, 0, 1])
@@ -774,7 +775,7 @@ def factorize(
774775 For all other pandas objects, an Index of the appropriate type is
775776 returned.
776777
777- >>> cat = pd.Series(['a', 'a', 'c' ])
778+ >>> cat = pd.Series(["a", "a", "c" ])
778779 >>> codes, uniques = pd.factorize(cat)
779780 >>> codes
780781 array([0, 0, 1])
0 commit comments