Section 1. Chapter 2
single
Challenge: Moving from Rows to Columns
Swipe to show menu
Task
Swipe to start coding
Implement the function add_total_reviews(df: pl.DataFrame) -> pl.DataFrame:
-
Inside the function, use the
.with_columns()context. -
Select
PositiveandNegativeusingpl.col(), add them together, and assign the aliasTotal Reviews. -
Ensure the function returns the modified Polars DataFrame.
Solution
Everything was clear?
Thanks for your feedback!
Section 1. Chapter 2
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat