From the course: Python: Programming Efficiently
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Exploit Python collections - Python Tutorial
From the course: Python: Programming Efficiently
Exploit Python collections
- [Instructor] There's a lot that we can do with the basic Python containers, lists and dict sets. In some cases, however we need more specialized objects. The standard library module collections of several more flavors or containers which are useful in different ways. Let's look at named tuple, which describes data records, counter which counts occurrences of elements in a sequence, defaultdict to implement dictionaries with default values, and deck to manipulate double ended cues. In the first version of this course, I also presented collections or the dict, which preserves insertion order in a dictionary. But now there's no need to break it up, since beginning in Python 2.6 insertion order is preserved by the standard dict object. As usual, I start by importing old packages that I need. We continue with our Olympic theme, a loaded data set of the gold medals awarded at a Summer Games in athletics only. Let's start by…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
(Locked)
Writing Python efficiently50s
-
(Locked)
Python vs. C4m 40s
-
(Locked)
Design efficient loops7m 3s
-
(Locked)
Comprehensions and generators6m 41s
-
(Locked)
Exploit Python collections7m 14s
-
(Locked)
Write Pythonic code6m 44s
-
(Locked)
Challenge: Analyze Olympic medalist data1m 20s
-
(Locked)
Solution: Analyze Olympic medalist data1m 33s
-
(Locked)
-
-
-
-