-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
API: Honor copy for dict-input in DataFrame #34872
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
7b892bd
acf99dd
499080b
20c87ce
b0b125d
f9b3f16
8bf9f73
306d015
bb730cc
9f716c8
a9db888
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1817,10 +1817,13 @@ def _shape_compat(x): | |
|
||
first = arrays[0] | ||
shape = (len(arrays),) + _shape_compat(first) | ||
|
||
stacked = np.empty(shape, dtype=dtype) | ||
for i, arr in enumerate(arrays): | ||
stacked[i] = _asarray_compat(arr) | ||
if len(arrays) == 1: | ||
# allow for 0-copy construction from dict | ||
stacked = _asarray_compat(first).reshape(shape) | ||
else: | ||
stacked = np.empty(shape, dtype=dtype) | ||
for i, arr in enumerate(arrays): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why can't you use the original loop i think that will also allow 0-copy construction , no? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sorry, I don't follow what you mean by original loop. The original loop I see is allocating memory and assigning into it, which doesn't allow 0-copy. |
||
stacked[i] = _asarray_compat(arr) | ||
|
||
return stacked, placement | ||
|
||
|
Uh oh!
There was an error while loading. Please reload this page.