8000 API / CoW: Copy NumPy arrays by default in DataFrame constructor by phofl · Pull Request #51731 · pandas-dev/pandas · GitHub
[go: up one dir, main page]

Skip to content

API / CoW: Copy NumPy arrays by default in DataFrame constructor #51731

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

Merged
merged 29 commits into from
Mar 17, 2023
Merged
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
563257e
Implement copy by default for numpy array
phofl Mar 1, 2023
f3161a3
Fix tests
phofl Mar 1, 2023
3a95311
Simplify
phofl Mar 2, 2023
17cf5ae
Fix
phofl Mar 2, 2023
07aa26d
Remove
phofl Mar 2, 2023
8e84d85
Merge branch 'main' into cow_copy_numpy_array
phofl Mar 2, 2023
f3ccf0f
Add comment
phofl Mar 3, 2023
5cdc6ad
Fix
phofl Mar 3, 2023
3e384ea
Change logic
phofl Mar 3, 2023
49ee53f
Merge remote-tracking branch 'upstream/main' into cow_copy_numpy_array
phofl Mar 3, 2023
fcc7be2
Fix tests
phofl Mar 3, 2023
9223836
Fix test
phofl Mar 3, 2023
a474bf5
Fix test
phofl Mar 3, 2023
d5a0268
Merge branch 'main' into cow_copy_numpy_array
phofl Mar 4, 2023
0be7fc6
Merge remote-tracking branch 'upstream/main' into cow_copy_numpy_array
phofl Mar 7, 2023
293f8a5
Remove order changes
phofl Mar 14, 2023
3376d06
Merge remote-tracking branch 'upstream/main' into cow_copy_numpy_array
phofl Mar 14, 2023
265d9e3
Update
phofl Mar 14, 2023
9ac1bae
Address review
phofl Mar 14, 2023
db92ce4
Add test
phofl Mar 14, 2023
be9cb04
Fix test
phofl Mar 15, 2023
4bf3ee8
Merge branch 'main' into cow_copy_numpy_array
phofl Mar 15, 2023
e2eceec
Fix array manager
phofl Mar 15, 2023
65965c6
Remove elif
phofl Mar 15, 2023
ecb756c
Update pandas/tests/copy_view/test_constructors.py
phofl Mar 15, 2023
8e837d9
Merge remote-tracking branch 'upstream/main' into cow_copy_numpy_array
phofl Mar 15, 2023
177fbbc
Add whatsnew
phofl Mar 15, 2023
2bbff3b
Merge branch 'main' into cow_copy_numpy_array
phofl Mar 16, 2023
5bef4ba
Add note
phofl Mar 16, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix array manager
  • Loading branch information
phofl committed Mar 15, 2023
commit e2eceec7f02e3542324fc1c6e8b3d94eb061162e
10 changes: 8 additions & 2 deletions pandas/tests/copy_view/test_constructors.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,11 +182,17 @@ def test_dataframe_from_dict_of_series_with_dtype(index):


@pytest.mark.parametrize("copy", [False, None, True])
def test_frame_from_numpy_array(using_copy_on_write, copy):
def test_frame_from_numpy_array(using_copy_on_write, copy, using_array_manager):
arr = np.array([[1, 2], [3, 4]])
df = DataFrame(arr, copy=copy)

if using_copy_on_write and copy is not False or copy is True:
if (
using_copy_on_write
and copy is not False
or copy is True
or using_array_manager
and copy is None
):
assert not np.shares_memory(get_array(df, 0), arr)
else:
assert np.shares_memory(get_array(df, 0), arr)
0