LoslegenKostenlos loslegen

Concatenating text columns

With the whitespace cleaned up, you realize that some products have the same detail but come in different sizes. To uniquely identify each product variant, you need to combine the detail and size columns into a single identifier.

Diese Übung ist Teil des Kurses

Data Transformation with Polars

Kurs anzeigen

Anleitung zur Übung

  • Concatenate the detail and size columns with a colon separator and name the new column detail_size.

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# Combine detail and size into a new column
reviews.with_columns(
    pl.____(["detail", "size"], separator="____").____("detail_size")
)
Code bearbeiten und ausführen