We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 0c6959d commit ffe0791Copy full SHA for ffe0791
pandas/core/dtypes/cast.py
@@ -1606,7 +1606,10 @@ def construct_1d_object_array_from_listlike(values: Collection) -> np.ndarray:
1606
"""
1607
# numpy will try to interpret nested lists as further dimensions in np.array(),
1608
# hence explicitly making a 1D array using np.fromiter
1609
- return np.fromiter(values, dtype="object", count=len(values))
+ result = np.empty(len(values), dtype="object")
1610
+ for i, obj in enumerate(values):
1611
+ result[i] = obj
1612
+ return result
1613
1614
1615
def maybe_cast_to_integer_array(arr: list | np.ndarray, dtype: np.dtype) -> np.ndarray:
0 commit comments