Skip to content

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

Closed
wants to merge 2 commits into from
Closed

DOC: add warning section in indexing docs. #13060

wants to merge 2 commits into from

Conversation

zhangxiangnick
Copy link
Contributor

Add warning section in indexing docs. Close #12947.

@zhangxiangnick zhangxiangnick changed the title Add warning section in indexing docs. Close #12947. DOC: add warning section in indexing docs. May 3, 2016

df.loc[:,['B', 'A']] = df.loc[:,['A', 'B']]

``df`` is not modified. The alignment is ignored in column assignment.
Copy link
Member

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

@jreback
Copy link
Contributor

jreback commented May 3, 2016

yeah this needs a bit more documentation of why this doesn't work and then what you should do instead.

@jreback jreback added Docs Indexing Related to indexing on series/frames, not to indexes themselves labels May 3, 2016
For assigning part of a DataFrame, explain why the assignment may not work and
then the correct way to do it.
@codecov-io
Copy link

codecov-io commented May 3, 2016

Current coverage is 84.14%

Merging #13060 into master will not change coverage

@@             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          

Powered by Codecov. Last updated by c6110e2...55ffdb1

@zhangxiangnick
Copy link
Contributor Author

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``.
Copy link
Contributor

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)

@zhangxiangnick zhangxiangnick deleted the doc_indexing branch May 3, 2016 17:50
jreback pushed a commit that referenced this pull request May 7, 2016
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Docs Indexing Related to indexing on series/frames, not to indexes themselves
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants