Work with real shapes of data / CORE PATH
Dictionaries & grouping
Mappings connect unique keys to values and support lookup and grouping.
Implement a small GROUP BY yourself before using pandas groupby.
Understand the idea
Mappings connect unique keys to values and support lookup and grouping. Implement a small GROUP BY yourself before using pandas groupby.
Work through the practice with a tiny fixture, predict the result before running it, and record one boundary case. Use the exit check as evidence before moving on.
What to learn
- Use items, keys, values and get deliberately.
- Aggregate amounts by category.
- Explain why repeated assignment to a key replaces its previous value.
A small original example
totals = {}
for row in [{"category": "Food", "amount": 300}, {"category": "Food", "amount": 200}]:
key = row["category"]
totals[key] = totals.get(key, 0) + row["amount"]
print(totals)Practice on your own data
Task 10: group transaction piastres by category.
Practice this lesson in the Python lab →
Two Food rows with 300 and 200 produce {"Food": 500}.
Common pitfalls
- dict.get(key) may return None if the key is absent.
- A dictionary is not a substitute for a validated database primary key.
Prerequisites
Lists, slices & comprehensions
Boot.dev chapter 10 · 05:44:48 ↗
Video and playlist companions
Choose one explanation for the concept, then attempt the practice. These are topic mappings, not a claim that every linked lesson covers every outcome.
Boot.dev · Python for Beginners
Loads YouTube on request. Open on YouTube ↗ if the owner restricts embedding.
كورس Python منحة ITI
Loads YouTube on request. Open on YouTube ↗ if the owner restricts embedding.
Python Full Course for Beginners (13 Hours) – From Zero to Hero
Loads YouTube on request. Open on YouTube ↗ if the owner restricts embedding.
Sources and further reading
- Boot.dev · Python for Beginners ↗User-selected YouTube course
- كورس Python منحة ITI ↗User-selected ITI playlist
- Harvard CS50P · lectures & problem sets ↗User-selected HarvardX CS50P course
- Python language tutorial ↗Official documentation
- Python Full Course for Beginners (13 Hours) – From Zero to Hero ↗User-selected YouTube resource
Track progress on this topic → · Markdown source ↗