Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Text Cleaning | Strings, Dates, Missing Data
Data Wrangling with Polars
Section 3. Chapter 2
single

single

Challenge: Text Cleaning

Swipe to show menu

Task

Swipe to start coding

Implement the function clean_game_titles(df: pl.DataFrame) -> pl.DataFrame.

  • Invoke the .with_columns() method to target and modify the existing column named exactly "Name".

  • Access the string namespace using .str and chain two transformations:

    • .strip_chars() to clear out leading and trailing whitespaces.

    • .to_uppercase() to format the game titles uniformly.

  • Return the updated Polars DataFrame. Do not alter or rename any other columns in the schema.

Solution

Switch to desktopSwitch to desktop for real-world practiceContinue from where you are using one of the options below
Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 3. Chapter 2
single

single

Ask AI

expand

Ask AI

ChatGPT

Ask anything or try one of the suggested questions to begin our chat

some-alt