Columns and Slices in Python
From the Pandas cheat sheet ยท Select Rows and Columns ยท verified Aug 2026
Columns and Slices
Select one or multiple columns and row slices.
python
names = df["name"]
subset = df[["name", "score"]]๐ One column returns a Series
๐ A column list returns a DataFrame
๐ก select_dtypes avoids hard-coded column lists
โ ๏ธ Plain slices apply to rows, not columns
columnsselectionslice
Continue with Pandas
Save the full cheat sheet or work through every related task.