File tree Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Expand file tree Collapse file tree 1 file changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -178,12 +178,26 @@ Getitem (``[]``)
178178~~~~~~~~~~~~~~~~
179179
180180For a :class: `DataFrame `, passing a single label selects a column and
181- yields a :class: `Series ` equivalent to `` df.A `` :
181+ yields a :class: `Series `:
182182
183183.. ipython :: python
184184
185185 df[" A" ]
186186
187+ If the label only contains letters, numbers, and underscores, you can
188+ alternatively use the column name attribute:
189+
190+ .. ipython :: python
191+
192+ df.A
193+
194+ Passing a list of column labels selects multiple columns, which can be useful
195+ for getting a subset/rearranging:
196+
197+ .. ipython :: python
198+
199+ df[[" B" , " A" ]]
200+
187201 For a :class: `DataFrame `, passing a slice ``: `` selects matching rows:
188202
189203.. ipython :: python
You can’t perform that action at this time.
0 commit comments