Save up to $499! Grab all Python courses for $49 or all online courses we’ve ever launched for only $169. Only Feb 11-16. Happy Valentine's!
Filtering by row
Extracting data by column
15. Using contains()
Practice using filter() and select()
The pipe operator
Sorting rows


We can also select columns based on their contents. If we wanted all columns with the word "population" in their name, we could enter each column name ourselves.

But there's a better way: using the contains() function. The string we want to match goes inside the contains() function, which becomes the second argument in the select() function. If the column name matches the contents of contains(), it will be selected.

To select all columns with "population" in their names, we'd use:

select(countries, contains("population"))


Select columns with "area" in their name using contains().

Stuck? Here's a hint!


select(countries, contains("area"))