BaşlayınÜcretsiz başlayın

Summarizing digital checkouts

The reporting team needs the total number of digital checkouts by material type for this week's summary. Build the entire pipeline lazily and call .collect() only at the very end so Polars can plan the whole query at once.

Bu egzersiz, kursun bir parçasıdır

Scaling and Optimizing Data Pipelines with Polars

Kursa Göz Atın

Egzersiz talimatları

  • Filter library to rows where use is "Digital".
  • Group the filtered rows by format.
  • Trigger execution at the very end of the pipeline.

Uygulamalı etkileşimli egzersiz

Bu egzersizi bu örnek kodu tamamlayarak deneyin.

result = (
    library
    # Filter to digital checkouts
    .filter(pl.col("use") == "____")
    # Group by format
    .group_by("____")
    .agg(pl.col("checkouts").sum().alias("total"))
    .sort("total", descending=True)
    # Trigger execution at the end
    .____()
)
print(result)
Kodu Düzenle ve Çalıştır