Filtering rows
📖 Scenario: You have a small table of fruits with their prices and quantities. You want to find only the fruits that cost more than 2 dollars.
🎯 Goal: Build a program that creates a data frame of fruits, sets a price limit, filters the fruits that cost more than that limit, and prints the filtered data.
📋 What You'll Learn
Create a data frame called
fruits with columns name, price, and quantityCreate a variable called
price_limit and set it to 2Filter the
fruits data frame to keep only rows where price is greater than price_limit and save it as expensive_fruitsPrint the
expensive_fruits data frame💡 Why This Matters
🌍 Real World
Filtering data tables is common when you want to focus on important or relevant information, like finding expensive products in a store.
💼 Career
Data filtering is a key skill in data analysis, reporting, and preparing data for decision making in many jobs.
Progress0 / 4 steps