Pandas version checks
Location of the documentation
https://pandas.pydata.org/docs/user_guide/10min.html#getitem
Documentation problem
The "Getitem ([])" section of the "10 minutes to pandas" tutorial shows that a single label in brackets will return a Series:
It also shows that a list of multiple labels returns a DataFrame:
It never shows the specific case of a list containing a single label (e.g. df[["A"]], which also returns a DataFrame). However, since df["A"] and df[["A"]] look nearly identical but return different object types, this could be a common point of confusion for beginners, yet isn't directly illustrated anywhere on this page. The distinction is already covered in the more comprehensive "Indexing and selecting data" guide, but it is not mentioned in the "10 minutes to pandas" tutorial, where many new users will actually first encounter column selection.
Suggested fix for documentation
Add a short note and example directly after the existing df[["B", "A"]] example, describing df[["A"]] and stating that it returns a DataFrame containing that one column, rather than a Series.
I would like to work on this myself, and plan submit a PR with the fix.
Pandas version checks
mainhereLocation of the documentation
https://pandas.pydata.org/docs/user_guide/10min.html#getitem
Documentation problem
The "Getitem ([])" section of the "10 minutes to pandas" tutorial shows that a single label in brackets will return a Series:
It also shows that a list of multiple labels returns a DataFrame:
It never shows the specific case of a list containing a single label (e.g.
df[["A"]], which also returns a DataFrame). However, sincedf["A"]anddf[["A"]]look nearly identical but return different object types, this could be a common point of confusion for beginners, yet isn't directly illustrated anywhere on this page. The distinction is already covered in the more comprehensive "Indexing and selecting data" guide, but it is not mentioned in the "10 minutes to pandas" tutorial, where many new users will actually first encounter column selection.Suggested fix for documentation
Add a short note and example directly after the existing
df[["B", "A"]]example, describingdf[["A"]]and stating that it returns a DataFrame containing that one column, rather than a Series.I would like to work on this myself, and plan submit a PR with the fix.