Section 1. Chapter 22
single
Challenge: Slicing and Subsetting
Swipe to show menu
Task
Swipe to start coding
Subset a data frame based on a condition and select specific columns.
- Filter rows in
dfwhere the value incondition_colequalscondition_value. - Select only the columns specified in
select_colsfrom the filtered rows. - Return the resulting data frame.
Solution
Everything was clear?
Thanks for your feedback!
Section 1. Chapter 22
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat