开始使用免费开始使用

Removing whitespace

With the ratings now stored as integers, you notice another issue in the dataset: some values in the detail column have leading whitespace. This inconsistency could cause problems when grouping products by their detail type - " eau de toilette" and "eau de toilette" would be treated as different categories.

本练习是课程的一部分

Data Transformation with Polars

查看课程

练习说明

  • Remove leading whitespace from the detail column by calling the .strip_chars_start() method.

交互式实操练习

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

# Remove leading whitespace from the detail column
reviews.____(
    pl.col("detail").____.____()
)
编辑并运行代码