1. Învăţa
  2. /
  3. Courses
  4. /
  5. Data Transformation with Polars

Connected

exercise

Chaining multiple conditions

You can also chain multiple conditions together. The product team wants to categorize products as "Large", "Medium", or "Small" based on their size for shipping optimization.

Instrucţiuni

100 XP
  • Check if the "size" column equals "100ml" and return "Large".
  • Check if the "size" column equals "50ml" and return "Medium".
  • Return "Small" for all other sizes and name the column "size_category".