Skip to content

Commit 8b6c64e

Browse files
committed
expand on different Getitem uses
1 parent c0c778b commit 8b6c64e

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

doc/source/user_guide/10min.rst

+15-1
Original file line numberDiff line numberDiff line change
@@ -178,12 +178,26 @@ Getitem (``[]``)
178178
~~~~~~~~~~~~~~~~
179179

180180
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`:
182182

183183
.. ipython:: python
184184
185185
df["A"]
186186
187+
If the label only contains letters, numbers, and underscores, you can
188+
alternatively use dot notation:
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

0 commit comments

Comments
 (0)