ComenzarEmpieza gratis

Extracting strings from text

Beyond searching, you can also extract specific keywords from text. The skincare team wants to personalize product recommendations based on customers' skin types mentioned in reviews.

Este ejercicio forma parte del curso

Data Transformation with Polars

Ver curso

Instrucciones del ejercicio

  • Extract "oily", "dry", or "sensitive" from the "review" column as a new column called "skin_type".

Ejercicio interactivo práctico

Prueba este ejercicio y completa el código de muestra.

# Extract skin type from reviews
reviews.with_columns(
    pl.col("review").str.____("(____|____|____)").alias("____")
)
Editar y ejecutar código