Skip to main content
`Ctrl`+`K`

# pandas.api.extensions.ExtensionArray._from_sequence

classmethod ExtensionArray._from_sequence(scalars, *, dtype=None, copy=False)

  Construct a new ExtensionArray from a sequence of scalars.

  This is a required method for ExtensionArray subclasses. It is used to create a new instance of the ExtensionArray from Python scalars or objects that can be converted to the array’s scalar type.

  Parameters:
    scalars Sequence

      Each element will be an instance of the scalar type for this array, `cls.dtype.type` or be converted into this type in this method.

    dtype dtype, optional

      Construct for this particular dtype. This should be a Dtype compatible with the ExtensionArray.

    copy bool, default False

      If True, copy the underlying data.

  Returns:
    ExtensionArray

  See also

  `api.extensions.ExtensionArray._from_sequence_of_strings`

    Construct a new ExtensionArray from a sequence of strings.

  `api.extensions.ExtensionArray._hash_pandas_object`

    Hook for hash_pandas_object.

  Examples

      >>> pd.arrays.IntegerArray._from_sequence([4, 5])
      <IntegerArray>
      [4, 5]
      Length: 2, dtype: Int64