开始使用免费开始使用

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.

本练习是课程的一部分

Data Transformation with Polars

查看课程

练习说明

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

交互式实操练习

通过完成这段示例代码来试试这个练习。

# Combine detail and size into a new column
reviews.with_columns(
    pl.____(["detail", "size"], separator="____").____("detail_size")
)
编辑并运行代码