diff --git a/doc/source/user_guide/10min.rst b/doc/source/user_guide/10min.rst index 72bb93d21a99f..8beaa73090673 100644 --- a/doc/source/user_guide/10min.rst +++ b/doc/source/user_guide/10min.rst @@ -178,12 +178,26 @@ Getitem (``[]``) ~~~~~~~~~~~~~~~~ For a :class:`DataFrame`, passing a single label selects a column and -yields a :class:`Series` equivalent to ``df.A``: +yields a :class:`Series`: .. ipython:: python df["A"] +If the label only contains letters, numbers, and underscores, you can +alternatively use the column name attribute: + +.. ipython:: python + + df.A + +Passing a list of column labels selects multiple columns, which can be useful +for getting a subset/rearranging: + +.. ipython:: python + + df[["B", "A"]] + For a :class:`DataFrame`, passing a slice ``:`` selects matching rows: .. ipython:: python