1. Apprendre
  2. /
  3. Cours
  4. /
  5. Data Transformation with Polars

Connected

Exercice

Replacing multiple patterns

The analytics team needs to calculate average product sizes, but the size column contains text values like "30ml" instead of numbers. You can replace multiple patterns at once to clean these values.

Instructions

100 XP
  • Replace "30ml", "50ml", and "100ml" in the "size" column with their numeric equivalents "30", "50", and "100".
  • Cast the "size" column to a 64-bit integer.