-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
BUG?: _is_view == False
for DataFrame from DataFrame
#11814
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
Comments
Your example is false. A dictionary NEVER creates a view. (I have a branch that fixes this by not consolidating, but thats a separate issue). Views are created by being passed numpy arrays (the view is to the array itself)
Note that this is NOT true for
|
Hi @jreback Think my example / issue was mis-understood. I agree creating a DataFrame from a dictionary never creates a view. The case I'm noting is that if you create a DataFrame from another DataFrame, then those are effectively views of one another, even if they reports In my example, if you change Indeed, view behavior documented in test modules (test_frame.py, line 2637):
|
so this is actually right.
e.g.
but this happens to fail if the object IS THE SAME OBJECT. E.g. in the case
So this is technically 'wrong', but its more semantics than anything else. Sharing the same object or a view of it are from pandas point of view de-facto the same. numpy makes this distinction, but not pandas. I suppose you could actually create a new block manager, where everything undering is created not with copy but with |
If you want to change this (independent of your other PR) and see if this actually breaks anything (except the test), I would accept a PR for that. |
Great! Will do -- need it for the other PR anyway. And thanks for the explanation! |
huh -- empty indexers do the same thing.
That ok to tweak too? |
PR means Personal Request? |
Constructing off a dataframe creates a de facto view, but
._is_view
reports false. Seems like a bug.Suggestions on how best to fix?
The text was updated successfully, but these errors were encountered: