Filter Rows by Condition
Easy
pandas
Airbnb
Uber
Given a list of dictionaries representing a dataset, return only the rows where the specified column's value meets a given threshold.
Example
data = [
{"name": "Alice", "age": 30, "salary": 70000},
{"name": "Bob", "age": 25, "salary": 50000},
{"name": "Charlie", "age": 35, "salary": 90000}
]
filter_rows(data, "salary", 60000)
# => [{"name": "Alice", "age": 30, "salary": 70000}, {"name": "Charlie", "age": 35, "salary": 90000}]
Test Cases
Python Editor
Output
Click "Run" to see results...