Skip to main content
`Ctrl`+`K`

# pandas.api.extensions.ExtensionArray._from_factorized

classmethod ExtensionArray._from_factorized(values, original)

  Reconstruct an ExtensionArray after factorization.

  Parameters:
    valuesndarray

      An integer ndarray with the factorized values.

    originalExtensionArray

      The original ExtensionArray that factorize was called on.

  See also

  `factorize`

    Top-level factorize method that dispatches here.

  `ExtensionArray.factorize`

    Encode the extension array as an enumerated type.

  Examples

      >>> interv_arr = pd.arrays.IntervalArray([pd.Interval(0, 1),
      ...                                      pd.Interval(1, 5), pd.Interval(1, 5)])
      >>> codes, uniques = pd.factorize(interv_arr)
      >>> pd.arrays.IntervalArray._from_factorized(uniques, interv_arr)
      <IntervalArray>
      [(0, 1], (1, 5]]
      Length: 2, dtype: interval[int64, right]