API / CoW: Copy NumPy arrays by default in DataFrame constructor
State: closed

- Parent issue: https://github.com/pandas-dev/pandas/issues/50776
- [ ] [Tests added and passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#writing-tests) if fixing a bug or adding a new feature
- [ ] All [code checks passed](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#pre-commit).
- [ ] Added [type annotations](https://pandas.pydata.org/pandas-docs/dev/development/contributing_codebase.html#type-hints) to new arguments/methods/functions.
- [ ] Added an entry in the latest `doc/source/whatsnew/vX.X.X.rst` file if fixing a bug or adding a new feature.


Labels:
name: Constructors
description: Series/DataFrame/Index/pd.array Constructors
name: Copy / view semantics

Comments:
I think many of the users/cases passing a single ndarray to DataFrame expect that to be no-copy and for `pd.DataFrame(arr).values` to round-trip without making a copy.  Asking them to pass `copy=False` isn't a huge burden, but it does add some friction to asking the to try out CoW, which im increasingly excited about.

it would help if we could disentangle "this makes CoW behave better" from "this makes reductions more performant" as the motivation here
This is just a solve two things with one pr thing here, happy to remove the order if you think this causes problems.

the actual problem I am trying to solve is the following:

```
arr = np.array([[1, 2], [3, 4]])
df = DataFrame(arr)
# Do some operations that don’t copy
arr[0, 0] = 100
```

If we don’t do a copy in the constructor, updating the array will update all dataframes as well

Edit: my motivation was that if we do a copy anyway, we can also change the order as well 
Added an explicit test
One other question, but not for this PR: this does it for the DataFrame constructor; so we should still do a follow-up for the Series constructor as well?
Good point, added
Yes we should, will put up a pr when this is merged
Thanks!
Owee, I'm MrMeeseeks, Look at me.

There seem to be a conflict, please backport manually. Here are approximate instructions:

1. Checkout backport branch and update it.

```
git checkout 2.0.x
git pull
```

2. Cherry pick the first parent branch of the this PR on top of the older branch:
```
git cherry-pick -x -m1 d534007e4cf07b8a8070f0ff9fe8875e5566f2d8
```

3. You will likely have some merge/cherry-pick conflict here, fix them and commit:

```
git commit -am 'Backport PR #51731: API / CoW: Copy NumPy arrays by default in DataFrame constructor'
```

4. Push to a named branch:

```
git push YOURFORK 2.0.x:auto-backport-of-pr-51731-on-2.0.x
```

5. Create a PR against branch 2.0.x, I would have named this PR:

> "Backport PR #51731 on branch 2.0.x (API / CoW: Copy NumPy arrays by default in DataFrame constructor)"

And apply the correct labels and milestones.

Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon!

Remember to remove the `Still Needs Manual Backport` label once the PR gets merged.

If these instructions are inaccurate, feel free to [suggest an improvement](https://github.com/MeeseeksBox/MeeseeksDev).
                
I'll open a backport pr