Skip to main content
`Ctrl`+`K`

# pandas.api.extensions.ExtensionArray._from_factorized

classmethod ExtensionArray._from_factorized(values, original)

  Reconstruct an ExtensionArray after factorization.

  This method reverses the encoding applied by `factorize()`, recreating an ExtensionArray from the unique values and original array metadata.

  Parameters:
    values ndarray

      An integer ndarray with the factorized values.

    original ExtensionArray

      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]