diff --git a/pandas/_libs/lib.pyx b/pandas/_libs/lib.pyx index 38695fbb8222b..0df739462b99d 100644 --- a/pandas/_libs/lib.pyx +++ b/pandas/_libs/lib.pyx @@ -2680,14 +2680,13 @@ def maybe_convert_objects(ndarray[object] objects, seen.object_ = True elif seen.str_: - if is_string_array(objects, skipna=True): - if using_pyarrow_string_dtype(): - import pyarrow as pa + if using_pyarrow_string_dtype() and is_string_array(objects, skipna=True): + import pyarrow as pa - from pandas.core.dtypes.dtypes import ArrowDtype + from pandas.core.dtypes.dtypes import ArrowDtype - dtype = ArrowDtype(pa.string()) - return dtype.construct_array_type()._from_sequence(objects, dtype=dtype) + dtype = ArrowDtype(pa.string()) + return dtype.construct_array_type()._from_sequence(objects, dtype=dtype) seen.object_ = True elif seen.interval_: