Section 1. Chapter 4
single
Challenge: Core Contexts select vs with_columns
Swipe to show menu
Task
Swipe to start coding
Implement the function calculate_positive_ratio(df: pl.DataFrame) -> pl.DataFrame.
-
Inside the function, use the
.with_columns()method on theDataFrame. -
Construct an expression that divides
Positiveby the sum ofPositiveandNegative. -
Name the resulting column
Positive Ratio.
Solution
Everything was clear?
Thanks for your feedback!
Section 1. Chapter 4
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat