Teilmengen von Pivot-Tabellen auswählen
Eine Pivot-Tabelle ist nichts anderes als ein DataFrame mit sortierten Indizes – du kannst also die bereits gelernten Techniken auch wieder zur Teilmengenauswahl nutzen. Vor allem die Kombination aus Slicing und .loc[] ist oft hilfreich.
pandas ist als pd geladen und temp_by_country_city_vs_year ist ebenfalls verfügbar.
Diese Übung ist Teil des Kurses
<Kurs>Datenbearbeitung mit pandas</Kurs>Übungsanweisungen
Wähle mit .loc[] folgende Teilmengen von temp_by_country_city_vs_year aus:
- von Egypt bis India
- von Egypt, Cairo bis India, Delhi
- von Egypt, Cairo bis India, Delhi und von 2005 bis 2010
Interaktive praktische Übung
Versuche dich an dieser Übung, indem du diesen Beispielcode vervollständigst.
# Subset for Egypt to India
____
# Subset for Egypt, Cairo to India, Delhi
____
# Subset for Egypt, Cairo to India, Delhi, and 2005 to 2010
____