Matching listings to budget requests
Budget is often the first filter travelers apply when searching for accommodation. You have a requests DataFrame with traveler preferences including maximum price. Match each listing to requests where the listing price is within the traveler's budget.
polars is loaded as pl, and the DataFrames hotels and requests are available for you.
本练习是课程的一部分
Data Transformation with Polars
练习说明
- Match
hotelstorequestswhere the listingpriceis at or below the request'smax_price. - Print a few rows to see the matches.
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Match listings within budget
matches = hotels.____(
requests,
pl.col("____") <= pl.col("____")
)
# Print a few rows
print(matches.____())