def array(data: Union[(Sequence[object], AnyArrayLike)], dtype: Optional[Dtype]=None, copy: bool=True) -> ExtensionArray:
    '\n    Create an array.\n\n    .. versionadded:: 0.24.0\n\n    Parameters\n    ----------\n    data : Sequence of objects\n        The scalars inside `data` should be instances of the\n        scalar type for `dtype`. It\'s expected that `data`\n        represents a 1-dimensional array of data.\n\n        When `data` is an Index or Series, the underlying array\n        will be extracted from `data`.\n\n    dtype : str, np.dtype, or ExtensionDtype, optional\n        The dtype to use for the array. This may be a NumPy\n        dtype or an extension type registered with pandas using\n        :meth:`pandas.api.extensions.register_extension_dtype`.\n\n        If not specified, there are two possibilities:\n\n        1. When `data` is a :class:`Series`, :class:`Index`, or\n           :class:`ExtensionArray`, the `dtype` will be taken\n           from the data.\n        2. Otherwise, pandas will attempt to infer the `dtype`\n           from the data.\n\n        Note that when `data` is a NumPy array, ``data.dtype`` is\n        *not* used for inferring the array type. This is because\n        NumPy cannot represent all the types of data that can be\n        held in extension arrays.\n\n        Currently, pandas will infer an extension dtype for sequences of\n\n        ============================== =====================================\n        Scalar Type                    Array Type\n        ============================== =====================================\n        :class:`pandas.Interval`       :class:`pandas.arrays.IntervalArray`\n        :class:`pandas.Period`         :class:`pandas.arrays.PeriodArray`\n        :class:`datetime.datetime`     :class:`pandas.arrays.DatetimeArray`\n        :class:`datetime.timedelta`    :class:`pandas.arrays.TimedeltaArray`\n        :class:`int`                   :class:`pandas.arrays.IntegerArray`\n        :class:`float`                 :class:`pandas.arrays.FloatingArray`\n        :class:`str`                   :class:`pandas.arrays.StringArray`\n        :class:`bool`                  :class:`pandas.arrays.BooleanArray`\n        ============================== =====================================\n\n        For all other cases, NumPy\'s usual inference rules will be used.\n\n        .. versionchanged:: 1.0.0\n\n           Pandas infers nullable-integer dtype for integer data,\n           string dtype for string data, and nullable-boolean dtype\n           for boolean data.\n\n        .. versionchanged:: 1.2.0\n\n            Pandas now also infers nullable-floating dtype for float-like\n            input data\n\n    copy : bool, default True\n        Whether to copy the data, even if not necessary. Depending\n        on the type of `data`, creating the new array may require\n        copying data, even if ``copy=False``.\n\n    Returns\n    -------\n    ExtensionArray\n        The newly created array.\n\n    Raises\n    ------\n    ValueError\n        When `data` is not 1-dimensional.\n\n    See Also\n    --------\n    numpy.array : Construct a NumPy array.\n    Series : Construct a pandas Series.\n    Index : Construct a pandas Index.\n    arrays.PandasArray : ExtensionArray wrapping a NumPy array.\n    Series.array : Extract the array stored within a Series.\n\n    Notes\n    -----\n    Omitting the `dtype` argument means pandas will attempt to infer the\n    best array type from the values in the data. As new array types are\n    added by pandas and 3rd party libraries, the "best" array type may\n    change. We recommend specifying `dtype` to ensure that\n\n    1. the correct array type for the data is returned\n    2. the returned array type doesn\'t change as new extension types\n       are added by pandas and third-party libraries\n\n    Additionally, if the underlying memory representation of the returned\n    array matters, we recommend specifying the `dtype` as a concrete object\n    rather than a string alias or allowing it to be inferred. For example,\n    a future version of pandas or a 3rd-party library may include a\n    dedicated ExtensionArray for string data. In this event, the following\n    would no longer return a :class:`arrays.PandasArray` backed by a NumPy\n    array.\n\n    >>> pd.array([\'a\', \'b\'], dtype=str)\n    <PandasArray>\n    [\'a\', \'b\']\n    Length: 2, dtype: str32\n\n    This would instead return the new ExtensionArray dedicated for string\n    data. If you really need the new array to be backed by a  NumPy array,\n    specify that in the dtype.\n\n    >>> pd.array([\'a\', \'b\'], dtype=np.dtype("<U1"))\n    <PandasArray>\n    [\'a\', \'b\']\n    Length: 2, dtype: str32\n\n    Finally, Pandas has arrays that mostly overlap with NumPy\n\n      * :class:`arrays.DatetimeArray`\n      * :class:`arrays.TimedeltaArray`\n\n    When data with a ``datetime64[ns]`` or ``timedelta64[ns]`` dtype is\n    passed, pandas will always return a ``DatetimeArray`` or ``TimedeltaArray``\n    rather than a ``PandasArray``. This is for symmetry with the case of\n    timezone-aware data, which NumPy does not natively support.\n\n    >>> pd.array([\'2015\', \'2016\'], dtype=\'datetime64[ns]\')\n    <DatetimeArray>\n    [\'2015-01-01 00:00:00\', \'2016-01-01 00:00:00\']\n    Length: 2, dtype: datetime64[ns]\n\n    >>> pd.array(["1H", "2H"], dtype=\'timedelta64[ns]\')\n    <TimedeltaArray>\n    [\'0 days 01:00:00\', \'0 days 02:00:00\']\n    Length: 2, dtype: timedelta64[ns]\n\n    Examples\n    --------\n    If a dtype is not specified, pandas will infer the best dtype from the values.\n    See the description of `dtype` for the types pandas infers for.\n\n    >>> pd.array([1, 2])\n    <IntegerArray>\n    [1, 2]\n    Length: 2, dtype: Int64\n\n    >>> pd.array([1, 2, np.nan])\n    <IntegerArray>\n    [1, 2, <NA>]\n    Length: 3, dtype: Int64\n\n    >>> pd.array([1.1, 2.2])\n    <FloatingArray>\n    [1.1, 2.2]\n    Length: 2, dtype: Float64\n\n    >>> pd.array(["a", None, "c"])\n    <StringArray>\n    [\'a\', <NA>, \'c\']\n    Length: 3, dtype: string\n\n    >>> pd.array([pd.Period(\'2000\', freq="D"), pd.Period("2000", freq="D")])\n    <PeriodArray>\n    [\'2000-01-01\', \'2000-01-01\']\n    Length: 2, dtype: period[D]\n\n    You can use the string alias for `dtype`\n\n    >>> pd.array([\'a\', \'b\', \'a\'], dtype=\'category\')\n    [\'a\', \'b\', \'a\']\n    Categories (2, object): [\'a\', \'b\']\n\n    Or specify the actual dtype\n\n    >>> pd.array([\'a\', \'b\', \'a\'],\n    ...          dtype=pd.CategoricalDtype([\'a\', \'b\', \'c\'], ordered=True))\n    [\'a\', \'b\', \'a\']\n    Categories (3, object): [\'a\' < \'b\' < \'c\']\n\n    If pandas does not infer a dedicated extension type a\n    :class:`arrays.PandasArray` is returned.\n\n    >>> pd.array([1 + 1j, 3 + 2j])\n    <PandasArray>\n    [(1+1j), (3+2j)]\n    Length: 2, dtype: complex128\n\n    As mentioned in the "Notes" section, new extension types may be added\n    in the future (by pandas or 3rd party libraries), causing the return\n    value to no longer be a :class:`arrays.PandasArray`. Specify the `dtype`\n    as a NumPy dtype if you need to ensure there\'s no future change in\n    behavior.\n\n    >>> pd.array([1, 2], dtype=np.dtype("int32"))\n    <PandasArray>\n    [1, 2]\n    Length: 2, dtype: int32\n\n    `data` must be 1-dimensional. A ValueError is raised when the input\n    has the wrong dimensionality.\n\n    >>> pd.array(1)\n    Traceback (most recent call last):\n      ...\n    ValueError: Cannot pass scalar \'1\' to \'pandas.array\'.\n    '
    from pandas.core.arrays import BooleanArray, DatetimeArray, FloatingArray, IntegerArray, IntervalArray, PandasArray, StringArray, TimedeltaArray, period_array
    if lib.is_scalar(data):
        msg = f"Cannot pass scalar '{data}' to 'pandas.array'."
        raise ValueError(msg)
    if ((dtype is None) and isinstance(data, (ABCSeries, ABCIndexClass, ABCExtensionArray))):
        dtype = data.dtype
    data = extract_array(data, extract_numpy=True)
    if isinstance(dtype, str):
        dtype = (registry.find(dtype) or dtype)
    if is_extension_array_dtype(dtype):
        cls = cast(ExtensionDtype, dtype).construct_array_type()
        return cls._from_sequence(data, dtype=dtype, copy=copy)
    if (dtype is None):
        inferred_dtype = lib.infer_dtype(data, skipna=True)
        if (inferred_dtype == 'period'):
            try:
                return period_array(data, copy=copy)
            except IncompatibleFrequency:
                pass
        elif (inferred_dtype == 'interval'):
            try:
                return IntervalArray(data, copy=copy)
            except ValueError:
                pass
        elif inferred_dtype.startswith('datetime'):
            try:
                return DatetimeArray._from_sequence(data, copy=copy)
            except ValueError:
                pass
        elif inferred_dtype.startswith('timedelta'):
            return TimedeltaArray._from_sequence(data, copy=copy)
        elif (inferred_dtype == 'string'):
            return StringArray._from_sequence(data, copy=copy)
        elif (inferred_dtype == 'integer'):
            return IntegerArray._from_sequence(data, copy=copy)
        elif (inferred_dtype in ('floating', 'mixed-integer-float')):
            return FloatingArray._from_sequence(data, copy=copy)
        elif (inferred_dtype == 'boolean'):
            return BooleanArray._from_sequence(data, copy=copy)
    if is_datetime64_ns_dtype(dtype):
        return DatetimeArray._from_sequence(data, dtype=dtype, copy=copy)
    elif is_timedelta64_ns_dtype(dtype):
        return TimedeltaArray._from_sequence(data, dtype=dtype, copy=copy)
    result = PandasArray._from_sequence(data, dtype=dtype, copy=copy)
    return result
Create an array.

.. versionadded:: 0.24.0

Parameters
----------
data : Sequence of objects
    The scalars inside `data` should be instances of the
    scalar type for `dtype`. It's expected that `data`
    represents a 1-dimensional array of data.

    When `data` is an Index or Series, the underlying array
    will be extracted from `data`.

dtype : str, np.dtype, or ExtensionDtype, optional
    The dtype to use for the array. This may be a NumPy
    dtype or an extension type registered with pandas using
    :meth:`pandas.api.extensions.register_extension_dtype`.

    If not specified, there are two possibilities:

    1. When `data` is a :class:`Series`, :class:`Index`, or
       :class:`ExtensionArray`, the `dtype` will be taken
       from the data.
    2. Otherwise, pandas will attempt to infer the `dtype`
       from the data.

    Note that when `data` is a NumPy array, ``data.dtype`` is
    *not* used for inferring the array type. This is because
    NumPy cannot represent all the types of data that can be
    held in extension arrays.

    Currently, pandas will infer an extension dtype for sequences of

    ============================== =====================================
    Scalar Type                    Array Type
    ============================== =====================================
    :class:`pandas.Interval`       :class:`pandas.arrays.IntervalArray`
    :class:`pandas.Period`         :class:`pandas.arrays.PeriodArray`
    :class:`datetime.datetime`     :class:`pandas.arrays.DatetimeArray`
    :class:`datetime.timedelta`    :class:`pandas.arrays.TimedeltaArray`
    :class:`int`                   :class:`pandas.arrays.IntegerArray`
    :class:`float`                 :class:`pandas.arrays.FloatingArray`
    :class:`str`                   :class:`pandas.arrays.StringArray`
    :class:`bool`                  :class:`pandas.arrays.BooleanArray`
    ============================== =====================================

    For all other cases, NumPy's usual inference rules will be used.

    .. versionchanged:: 1.0.0

       Pandas infers nullable-integer dtype for integer data,
       string dtype for string data, and nullable-boolean dtype
       for boolean data.

    .. versionchanged:: 1.2.0

        Pandas now also infers nullable-floating dtype for float-like
        input data

copy : bool, default True
    Whether to copy the data, even if not necessary. Depending
    on the type of `data`, creating the new array may require
    copying data, even if ``copy=False``.

Returns
-------
ExtensionArray
    The newly created array.

Raises
------
ValueError
    When `data` is not 1-dimensional.

See Also
--------
numpy.array : Construct a NumPy array.
Series : Construct a pandas Series.
Index : Construct a pandas Index.
arrays.PandasArray : ExtensionArray wrapping a NumPy array.
Series.array : Extract the array stored within a Series.

Notes
-----
Omitting the `dtype` argument means pandas will attempt to infer the
best array type from the values in the data. As new array types are
added by pandas and 3rd party libraries, the "best" array type may
change. We recommend specifying `dtype` to ensure that

1. the correct array type for the data is returned
2. the returned array type doesn't change as new extension types
   are added by pandas and third-party libraries

Additionally, if the underlying memory representation of the returned
array matters, we recommend specifying the `dtype` as a concrete object
rather than a string alias or allowing it to be inferred. For example,
a future version of pandas or a 3rd-party library may include a
dedicated ExtensionArray for string data. In this event, the following
would no longer return a :class:`arrays.PandasArray` backed by a NumPy
array.

>>> pd.array(['a', 'b'], dtype=str)
<PandasArray>
['a', 'b']
Length: 2, dtype: str32

This would instead return the new ExtensionArray dedicated for string
data. If you really need the new array to be backed by a  NumPy array,
specify that in the dtype.

>>> pd.array(['a', 'b'], dtype=np.dtype("<U1"))
<PandasArray>
['a', 'b']
Length: 2, dtype: str32

Finally, Pandas has arrays that mostly overlap with NumPy

  * :class:`arrays.DatetimeArray`
  * :class:`arrays.TimedeltaArray`

When data with a ``datetime64[ns]`` or ``timedelta64[ns]`` dtype is
passed, pandas will always return a ``DatetimeArray`` or ``TimedeltaArray``
rather than a ``PandasArray``. This is for symmetry with the case of
timezone-aware data, which NumPy does not natively support.

>>> pd.array(['2015', '2016'], dtype='datetime64[ns]')
<DatetimeArray>
['2015-01-01 00:00:00', '2016-01-01 00:00:00']
Length: 2, dtype: datetime64[ns]

>>> pd.array(["1H", "2H"], dtype='timedelta64[ns]')
<TimedeltaArray>
['0 days 01:00:00', '0 days 02:00:00']
Length: 2, dtype: timedelta64[ns]

Examples
--------
If a dtype is not specified, pandas will infer the best dtype from the values.
See the description of `dtype` for the types pandas infers for.

>>> pd.array([1, 2])
<IntegerArray>
[1, 2]
Length: 2, dtype: Int64

>>> pd.array([1, 2, np.nan])
<IntegerArray>
[1, 2, <NA>]
Length: 3, dtype: Int64

>>> pd.array([1.1, 2.2])
<FloatingArray>
[1.1, 2.2]
Length: 2, dtype: Float64

>>> pd.array(["a", None, "c"])
<StringArray>
['a', <NA>, 'c']
Length: 3, dtype: string

>>> pd.array([pd.Period('2000', freq="D"), pd.Period("2000", freq="D")])
<PeriodArray>
['2000-01-01', '2000-01-01']
Length: 2, dtype: period[D]

You can use the string alias for `dtype`

>>> pd.array(['a', 'b', 'a'], dtype='category')
['a', 'b', 'a']
Categories (2, object): ['a', 'b']

Or specify the actual dtype

>>> pd.array(['a', 'b', 'a'],
...          dtype=pd.CategoricalDtype(['a', 'b', 'c'], ordered=True))
['a', 'b', 'a']
Categories (3, object): ['a' < 'b' < 'c']

If pandas does not infer a dedicated extension type a
:class:`arrays.PandasArray` is returned.

>>> pd.array([1 + 1j, 3 + 2j])
<PandasArray>
[(1+1j), (3+2j)]
Length: 2, dtype: complex128

As mentioned in the "Notes" section, new extension types may be added
in the future (by pandas or 3rd party libraries), causing the return
value to no longer be a :class:`arrays.PandasArray`. Specify the `dtype`
as a NumPy dtype if you need to ensure there's no future change in
behavior.

>>> pd.array([1, 2], dtype=np.dtype("int32"))
<PandasArray>
[1, 2]
Length: 2, dtype: int32

`data` must be 1-dimensional. A ValueError is raised when the input
has the wrong dimensionality.

>>> pd.array(1)
Traceback (most recent call last):
  ...
ValueError: Cannot pass scalar '1' to 'pandas.array'.
def array(data: Union[(Sequence[object], AnyArrayLike)], dtype: Optional[Dtype]=None, copy: bool=True) -> ExtensionArray:
    '\n    Create an array.\n\n    .. versionadded:: 0.24.0\n\n    Parameters\n    ----------\n    data : Sequence of objects\n        The scalars inside `data` should be instances of the\n        scalar type for `dtype`. It\'s expected that `data`\n        represents a 1-dimensional array of data.\n\n        When `data` is an Index or Series, the underlying array\n        will be extracted from `data`.\n\n    dtype : str, np.dtype, or ExtensionDtype, optional\n        The dtype to use for the array. This may be a NumPy\n        dtype or an extension type registered with pandas using\n        :meth:`pandas.api.extensions.register_extension_dtype`.\n\n        If not specified, there are two possibilities:\n\n        1. When `data` is a :class:`Series`, :class:`Index`, or\n           :class:`ExtensionArray`, the `dtype` will be taken\n           from the data.\n        2. Otherwise, pandas will attempt to infer the `dtype`\n           from the data.\n\n        Note that when `data` is a NumPy array, ``data.dtype`` is\n        *not* used for inferring the array type. This is because\n        NumPy cannot represent all the types of data that can be\n        held in extension arrays.\n\n        Currently, pandas will infer an extension dtype for sequences of\n\n        ============================== =====================================\n        Scalar Type                    Array Type\n        ============================== =====================================\n        :class:`pandas.Interval`       :class:`pandas.arrays.IntervalArray`\n        :class:`pandas.Period`         :class:`pandas.arrays.PeriodArray`\n        :class:`datetime.datetime`     :class:`pandas.arrays.DatetimeArray`\n        :class:`datetime.timedelta`    :class:`pandas.arrays.TimedeltaArray`\n        :class:`int`                   :class:`pandas.arrays.IntegerArray`\n        :class:`float`                 :class:`pandas.arrays.FloatingArray`\n        :class:`str`                   :class:`pandas.arrays.StringArray`\n        :class:`bool`                  :class:`pandas.arrays.BooleanArray`\n        ============================== =====================================\n\n        For all other cases, NumPy\'s usual inference rules will be used.\n\n        .. versionchanged:: 1.0.0\n\n           Pandas infers nullable-integer dtype for integer data,\n           string dtype for string data, and nullable-boolean dtype\n           for boolean data.\n\n        .. versionchanged:: 1.2.0\n\n            Pandas now also infers nullable-floating dtype for float-like\n            input data\n\n    copy : bool, default True\n        Whether to copy the data, even if not necessary. Depending\n        on the type of `data`, creating the new array may require\n        copying data, even if ``copy=False``.\n\n    Returns\n    -------\n    ExtensionArray\n        The newly created array.\n\n    Raises\n    ------\n    ValueError\n        When `data` is not 1-dimensional.\n\n    See Also\n    --------\n    numpy.array : Construct a NumPy array.\n    Series : Construct a pandas Series.\n    Index : Construct a pandas Index.\n    arrays.PandasArray : ExtensionArray wrapping a NumPy array.\n    Series.array : Extract the array stored within a Series.\n\n    Notes\n    -----\n    Omitting the `dtype` argument means pandas will attempt to infer the\n    best array type from the values in the data. As new array types are\n    added by pandas and 3rd party libraries, the "best" array type may\n    change. We recommend specifying `dtype` to ensure that\n\n    1. the correct array type for the data is returned\n    2. the returned array type doesn\'t change as new extension types\n       are added by pandas and third-party libraries\n\n    Additionally, if the underlying memory representation of the returned\n    array matters, we recommend specifying the `dtype` as a concrete object\n    rather than a string alias or allowing it to be inferred. For example,\n    a future version of pandas or a 3rd-party library may include a\n    dedicated ExtensionArray for string data. In this event, the following\n    would no longer return a :class:`arrays.PandasArray` backed by a NumPy\n    array.\n\n    >>> pd.array([\'a\', \'b\'], dtype=str)\n    <PandasArray>\n    [\'a\', \'b\']\n    Length: 2, dtype: str32\n\n    This would instead return the new ExtensionArray dedicated for string\n    data. If you really need the new array to be backed by a  NumPy array,\n    specify that in the dtype.\n\n    >>> pd.array([\'a\', \'b\'], dtype=np.dtype("<U1"))\n    <PandasArray>\n    [\'a\', \'b\']\n    Length: 2, dtype: str32\n\n    Finally, Pandas has arrays that mostly overlap with NumPy\n\n      * :class:`arrays.DatetimeArray`\n      * :class:`arrays.TimedeltaArray`\n\n    When data with a ``datetime64[ns]`` or ``timedelta64[ns]`` dtype is\n    passed, pandas will always return a ``DatetimeArray`` or ``TimedeltaArray``\n    rather than a ``PandasArray``. This is for symmetry with the case of\n    timezone-aware data, which NumPy does not natively support.\n\n    >>> pd.array([\'2015\', \'2016\'], dtype=\'datetime64[ns]\')\n    <DatetimeArray>\n    [\'2015-01-01 00:00:00\', \'2016-01-01 00:00:00\']\n    Length: 2, dtype: datetime64[ns]\n\n    >>> pd.array(["1H", "2H"], dtype=\'timedelta64[ns]\')\n    <TimedeltaArray>\n    [\'0 days 01:00:00\', \'0 days 02:00:00\']\n    Length: 2, dtype: timedelta64[ns]\n\n    Examples\n    --------\n    If a dtype is not specified, pandas will infer the best dtype from the values.\n    See the description of `dtype` for the types pandas infers for.\n\n    >>> pd.array([1, 2])\n    <IntegerArray>\n    [1, 2]\n    Length: 2, dtype: Int64\n\n    >>> pd.array([1, 2, np.nan])\n    <IntegerArray>\n    [1, 2, <NA>]\n    Length: 3, dtype: Int64\n\n    >>> pd.array([1.1, 2.2])\n    <FloatingArray>\n    [1.1, 2.2]\n    Length: 2, dtype: Float64\n\n    >>> pd.array(["a", None, "c"])\n    <StringArray>\n    [\'a\', <NA>, \'c\']\n    Length: 3, dtype: string\n\n    >>> pd.array([pd.Period(\'2000\', freq="D"), pd.Period("2000", freq="D")])\n    <PeriodArray>\n    [\'2000-01-01\', \'2000-01-01\']\n    Length: 2, dtype: period[D]\n\n    You can use the string alias for `dtype`\n\n    >>> pd.array([\'a\', \'b\', \'a\'], dtype=\'category\')\n    [\'a\', \'b\', \'a\']\n    Categories (2, object): [\'a\', \'b\']\n\n    Or specify the actual dtype\n\n    >>> pd.array([\'a\', \'b\', \'a\'],\n    ...          dtype=pd.CategoricalDtype([\'a\', \'b\', \'c\'], ordered=True))\n    [\'a\', \'b\', \'a\']\n    Categories (3, object): [\'a\' < \'b\' < \'c\']\n\n    If pandas does not infer a dedicated extension type a\n    :class:`arrays.PandasArray` is returned.\n\n    >>> pd.array([1 + 1j, 3 + 2j])\n    <PandasArray>\n    [(1+1j), (3+2j)]\n    Length: 2, dtype: complex128\n\n    As mentioned in the "Notes" section, new extension types may be added\n    in the future (by pandas or 3rd party libraries), causing the return\n    value to no longer be a :class:`arrays.PandasArray`. Specify the `dtype`\n    as a NumPy dtype if you need to ensure there\'s no future change in\n    behavior.\n\n    >>> pd.array([1, 2], dtype=np.dtype("int32"))\n    <PandasArray>\n    [1, 2]\n    Length: 2, dtype: int32\n\n    `data` must be 1-dimensional. A ValueError is raised when the input\n    has the wrong dimensionality.\n\n    >>> pd.array(1)\n    Traceback (most recent call last):\n      ...\n    ValueError: Cannot pass scalar \'1\' to \'pandas.array\'.\n    '
    from pandas.core.arrays import BooleanArray, DatetimeArray, FloatingArray, IntegerArray, IntervalArray, PandasArray, StringArray, TimedeltaArray, period_array
    if lib.is_scalar(data):
        msg = f"Cannot pass scalar '{data}' to 'pandas.array'."
        raise ValueError(msg)
    if ((dtype is None) and isinstance(data, (ABCSeries, ABCIndexClass, ABCExtensionArray))):
        dtype = data.dtype
    data = extract_array(data, extract_numpy=True)
    if isinstance(dtype, str):
        dtype = (registry.find(dtype) or dtype)
    if is_extension_array_dtype(dtype):
        cls = cast(ExtensionDtype, dtype).construct_array_type()
        return cls._from_sequence(data, dtype=dtype, copy=copy)
    if (dtype is None):
        inferred_dtype = lib.infer_dtype(data, skipna=True)
        if (inferred_dtype == 'period'):
            try:
                return period_array(data, copy=copy)
            except IncompatibleFrequency:
                pass
        elif (inferred_dtype == 'interval'):
            try:
                return IntervalArray(data, copy=copy)
            except ValueError:
                pass
        elif inferred_dtype.startswith('datetime'):
            try:
                return DatetimeArray._from_sequence(data, copy=copy)
            except ValueError:
                pass
        elif inferred_dtype.startswith('timedelta'):
            return TimedeltaArray._from_sequence(data, copy=copy)
        elif (inferred_dtype == 'string'):
            return StringArray._from_sequence(data, copy=copy)
        elif (inferred_dtype == 'integer'):
            return IntegerArray._from_sequence(data, copy=copy)
        elif (inferred_dtype in ('floating', 'mixed-integer-float')):
            return FloatingArray._from_sequence(data, copy=copy)
        elif (inferred_dtype == 'boolean'):
            return BooleanArray._from_sequence(data, copy=copy)
    if is_datetime64_ns_dtype(dtype):
        return DatetimeArray._from_sequence(data, dtype=dtype, copy=copy)
    elif is_timedelta64_ns_dtype(dtype):
        return TimedeltaArray._from_sequence(data, dtype=dtype, copy=copy)
    result = PandasArray._from_sequence(data, dtype=dtype, copy=copy)
    return result