1. 学ぶ
  2. /
  3. コース
  4. /
  5. Data Transformation with Polars

Connected

演習

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.

指示

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