Mulai sekarangMulai gratis

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.

Latihan ini merupakan bagian dari kursus

Data Transformation with Polars

Lihat Kursus

Instruksi latihan

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

Latihan interaktif langsung praktik

Cobalah latihan ini dengan melengkapi kode contoh ini.

# Combine detail and size into a new column
reviews.with_columns(
    pl.____(["detail", "size"], separator="____").____("detail_size")
)
Edit dan Jalankan Kode