Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Learn Challenge: Moving from Rows to Columns | Paradigm Shift, Selection
Data Wrangling with Polars
Section 1. Chapter 2
single

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 Positive and Negative using pl.col(), add them together, and assign the alias Total Reviews.

  • Ensure the function returns the modified Polars DataFrame.

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 1. 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