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 (``[]``)
178
178
~~~~~~~~~~~~~~~~
179
179
180
180
For 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 `:
182
182
183
183
.. ipython :: python
184
184
185
185
df[" A" ]
186
186
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
+
187
201
For a :class: `DataFrame `, passing a slice ``: `` selects matching rows:
188
202
189
203
.. ipython :: python
You can’t perform that action at this time.
0 commit comments