LoslegenKostenlos loslegen

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.

Diese Übung ist Teil des Kurses

Data Transformation with Polars

Kurs anzeigen

Anleitung zur Übung

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

Interaktive Übung

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

# Remove leading whitespace from the detail column
reviews.____(
    pl.col("detail").____.____()
)
Code bearbeiten und ausführen