-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
DOC: add warning section in indexing docs. #13060
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
Conversation
|
||
df.loc[:,['B', 'A']] = df.loc[:,['A', 'B']] | ||
|
||
``df`` is not modified. The alignment is ignored in column assignment. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would maybe be good to also give an illustration of the last sentence
yeah this needs a bit more documentation of why this doesn't work and then what you should do instead. |
For assigning part of a DataFrame, explain why the assignment may not work and then the correct way to do it.
Current coverage is 84.14%@@ master #13060 diff @@
==========================================
Files 137 137
Lines 50227 50227
Methods 0 0
Messages 0 0
Branches 0 0
==========================================
Hits 42261 42261
Misses 7966 7966
Partials 0 0
|
Add why the DataFrame assignment may not work and then the correct to do it. Anything else I can do? |
@@ -191,6 +191,29 @@ raised. Multiple columns can also be set in this manner: | |||
You may find this useful for applying a transform (in-place) to a subset of the | |||
columns. | |||
|
|||
.. warning:: | |||
|
|||
pandas aligns index for setting a ``DataFrame`` from ``.loc``, ``.iloc`` and ``.ix``. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aligns for when setting (not specific to DataFrame
)
Replace PR #13060 close #12947 Author: Xiang Zhang <[email protected]> Closes #13070 from zhangxiangnick/doc_indexing_v2 and squashes the following commits: f9ade87 [Xiang Zhang] add warning section in indexing doc.
Add warning section in indexing docs. Close #12947.