LoslegenKostenlos starten

Unnesting production_country

Back to the movie dataset from the streaming startup. This time, focus on production_country: each row holds two nested fields, a country code and a country name. Unnest the struct so those fields become regular top-level columns.

Diese Übung ist Teil des Kurses

<Kurs>Scaling and Optimizing Data Pipelines with Polars</Kurs>
Kurs ansehen

Übungsanweisungen

  • Unnest the production_country struct column so its fields become regular columns.

Interaktive praktische Übung

Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.

# Flatten the struct into columns
result = movies.____("production_country").select(
    "movie_title", "code", "name"
).head(8)
print(result)
Code bearbeiten und ausführen