ComeçarComece de graça

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.

Este exercício faz parte do curso

Data Transformation with Polars

Ver curso

Instruções do exercício

  • Join hotels with type_benchmarks on type and beach, keeping all rows from hotels.
  • Print a few rows to see the result.

Exercício interativo prático

Experimente este exercício completando este código de exemplo.

# Keep all rows from hotels
with_targets = hotels.____(____, on=["type", "beach"], how="____")

# Print a few rows
print(with_targets.____())
Editar e executar o código