Skip to content

Commit 4059ff6

Browse files
committed
fixed implicit conversion of 1-arrays inside data frames
1 parent 9458f3e commit 4059ff6

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

pandas/core/internals/managers.py

+4-1
Original file line numberDiff line numberDiff line change
@@ -2171,7 +2171,10 @@ def setitem_inplace(self, indexer, value) -> None:
21712171
# dt64/td64, which do their own validation.
21722172
value = np_can_hold_element(arr.dtype, value)
21732173

2174-
if isinstance(value, np.ndarray) and value.ndim == 1 and len(value) == 1:
2174+
# check if the dtype of the block is object
2175+
implicit_convert = arr.dtype != 'object'
2176+
if (isinstance(value, np.ndarray) and value.ndim == 1 and len(value) == 1
2177+
and implicit_convert):
21752178
# NumPy 1.25 deprecation: https://github.com/numpy/numpy/pull/10615
21762179
value = value[0, ...]
21772180

0 commit comments

Comments
 (0)