File tree 1 file changed +11
-1
lines changed
1 file changed +11
-1
lines changed Original file line number Diff line number Diff line change @@ -155,7 +155,7 @@ columns.
155
155
156
156
.. warning ::
157
157
158
- pandas aligns all AXES when setting ``Series `` and ``DataFrame `` from ``.loc ``, and `` .iloc `` .
158
+ pandas aligns all AXES when setting ``Series `` and ``DataFrame `` from ``.loc ``.
159
159
160
160
This will **not ** modify ``df `` because the column alignment is before value assignment.
161
161
@@ -172,6 +172,16 @@ columns.
172
172
df.loc[:, [' B' , ' A' ]] = df[[' A' , ' B' ]].to_numpy()
173
173
df[[' A' , ' B' ]]
174
174
175
+ However, pandas does not aligns AXES when setting ``Series `` and ``DataFrame `` from ``.iloc ``.
176
+
177
+ This will modify ``df `` because the column alignment is not done before value assignment.
178
+
179
+ .. ipython :: python
180
+
181
+ df[[' A' , ' B' ]]
182
+ df.iloc[:, [1 , 0 ]] = df[[' A' , ' B' ]]
183
+ df[[' A' ,' B' ]]
184
+
175
185
176
186
Attribute access
177
187
----------------
You can’t perform that action at this time.
0 commit comments