Skip to content

Commit d9f8e6e

Browse files
committed
is_extension_dtype -> hasattr
1 parent 3262d8f commit d9f8e6e

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

pandas/_libs/lib.pyx

+2-4
Original file line numberDiff line numberDiff line change
@@ -651,12 +651,10 @@ cpdef ndarray[object] ensure_string_array(
651651
cdef:
652652
Py_ssize_t i = 0, n = len(arr)
653653

654-
from pandas.core.dtypes.common import is_extension_array_dtype
655-
656-
if is_extension_array_dtype(arr):
654+
if hasattr(arr, "to_numpy"):
657655
arr = arr.to_numpy()
658656
elif not isinstance(arr, np.ndarray):
659-
arr = np.array(arr, dtype=object)
657+
arr = np.array(arr, dtype="object")
660658

661659
result = np.asarray(arr, dtype="object")
662660

0 commit comments

Comments
 (0)