We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 438f2d4 commit 59e5d93Copy full SHA for 59e5d93
pandas/core/internals/construction.py
@@ -250,10 +250,12 @@ def ndarray_to_mgr(
250
251
elif isinstance(values, (np.ndarray, ExtensionArray)):
252
# drop subclass info
253
- _copy = (
254
- copy if (dtype is None or astype_is_view(values.dtype, dtype)) else False
255
- )
256
- values = np.array(values, copy=_copy)
+ if copy and (dtype is None or astype_is_view(values.dtype, dtype)):
+ # only force a copy now if copy=True was requested
+ # and a subsequent `astype` will not already result in a copy
+ values = np.array(values, copy=True, order="F")
257
+ else:
258
+ values = np.array(values, copy=False)
259
values = _ensure_2d(values)
260
261
else:
0 commit comments