Section 3. Chapter 2
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
.strand 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
Everything was clear?
Thanks for your feedback!
Section 3. Chapter 2
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat