Subsetting columns
When working with data, you may not need all of the variables in your dataset. Square brackets ([]) can be used to select only the columns that matter to you in an order that makes sense to you.
To select only "col_a" of the DataFrame df, use
df["col_a"]
To select "col_a" and "col_b" of df, use
df[["col_a", "col_b"]]
homelessness is available and pandas is loaded as pd.
This exercise is part of the course
Data Manipulation with pandas
Hands-on interactive exercise
Have a go at this exercise by completing this sample code.
# Select the individuals column
individuals = ____
print(individuals.head())