Preserving all listings
Sometimes reference data is incomplete, but you still need every listing for reporting. You want to keep all rows from hotels even when there's no matching benchmark - missing values should appear as null.
polars is loaded as pl, and the DataFrames hotels and type_benchmarks are available for you.
本练习是课程的一部分
Data Transformation with Polars
练习说明
- Join
hotelswithtype_benchmarksontypeandbeach, keeping all rows fromhotels. - Print a few rows to see the result.
交互式实操练习
通过完成这段示例代码来试试这个练习。
# Keep all rows from hotels
with_targets = hotels.____(____, on=["type", "beach"], how="____")
# Print a few rows
print(with_targets.____())