MulaiMulai sekarang secara gratis

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.

Latihan ini adalah bagian dari kursus

Data Transformation with Polars

Lihat Kursus

Petunjuk latihan

  • Match hotels to requests where the listing price is at or below the request's max_price.
  • Print a few rows to see the matches.

Latihan interaktif praktis

Cobalah latihan ini dengan menyelesaikan kode contoh berikut.

# Match listings within budget
matches = hotels.____(
    requests,
    pl.col("____") <= pl.col("____")
)

# Print a few rows
print(matches.____())
Edit dan Jalankan Kode