1. Học hỏi
  2. /
  3. Khoa Học
  4. /
  5. Data Transformation with Polars

Connected

Bài tập

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.

Hướng dẫn

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