1. Filter rows by price
Write code Easy ✓ CompletedWrite a function pricier_than(df, limit) that returns a DataFrame with only the rows of df whose price is greater than limit. Keep all the columns.
import pandas as pd
books = pd.DataFrame({
"title": ["Dune", "Emma", "Ulysses", "Matilda", "Beloved"],
"price": [9.99, 6.50, 14.00, 7.25, 11.80],
})
def pricier_than(df, limit):
# return only the rows where price > limit
pass
print(pricier_than(books, 9))import pandas as pd
books = pd.DataFrame({
"title": ["Dune", "Emma", "Ulysses", "Matilda", "Beloved"],
"price": [9.99, 6.50, 14.00, 7.25, 11.80],
})
def pricier_than(df, limit):
return df[df["price"] > limit]
print(pricier_than(books, 9))