Skip to content
Merged
Changes from 2 commits
Commits
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
12 changes: 11 additions & 1 deletion doc/source/user_guide/indexing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ columns.

.. warning::

pandas aligns all AXES when setting ``Series`` and ``DataFrame`` from ``.loc``, and ``.iloc``.
pandas aligns all AXES when setting ``Series`` and ``DataFrame`` from ``.loc``.

This will **not** modify ``df`` because the column alignment is before value assignment.

Expand All @@ -172,6 +172,16 @@ columns.
df.loc[:, ['B', 'A']] = df[['A', 'B']].to_numpy()
df[['A', 'B']]

However, pandas does not aligns AXES when setting ``Series`` and ``DataFrame`` from ``.iloc``.

This will modify ``df`` because the column alignment is not done before value assignment.

.. ipython:: python

df[['A', 'B']]
df.iloc[:, [1, 0]] = df[['A', 'B']]
df[['A','B']]


Attribute access
----------------
Expand Down