
Discover associative arrays by linking keys to values, using dictionaries and hash maps, and practice adding, removing, modifying, and looking up elements efficiently in Python.
Explore creating dictionaries with literals and constructors, understand hashing and key equality, and use tuples or functions as keys, plus dictionary comprehension and from keys.
Master common dictionary operations in Python: assign and update keys, use get with defaults, test membership, and remove items with del, pop, popitem, or setdefault, noting insertion order since 3.6.
Explore dictionary views—keys, values, and items—and how they are dynamic, iterable, and reflect insertion order. Learn their set-like behavior, non-updatability, and common operations like union, intersection, and difference.
Explore dictionary views in Python, including keys, values, and items; learn to perform set-like operations (union, intersection, difference) on views, iterate efficiently, and build dictionaries with comprehensions.
Explore how to use custom classes as dictionary keys by implementing equality and hashing, and understand hash tables, probe sequences, and how collisions affect insertion and lookup.
Explore how Python sets support membership tests, unions, intersections, and differences, and compare mutable sets with frozen sets, emphasizing hashability and fast lookups.
Learn how to create and use sets in Python, including literal notation, the set constructor, and set unpacking, to obtain unique hashable elements from iterables.
Explore set operations such as intersection, union, disjoint tests, differences, and symmetric differences using sets and iterables, with subsets, supersets, and practical caveats with lists.
Explore update operations on sets, including intersection, union, difference, and symmetric difference, and compare mutating methods with operator forms.
Explore frozen sets, the immutable counterparts of sets that remain hashable when elements are hashable and can be used as dictionary keys. Understand copy behavior and nonmutating set operations.
Explore how dictionary views evolve from lists to light-weight, set-like iterables for keys, values, and items, and learn safe iteration and set-like operations.
Explore how Python's pickle module serializes and deserializes dictionaries and basic data types, including dumps and loads, and examine security risks from untrusted pickled objects.
Explore json serialization basics, a text-based, human-readable format for web APIs, and safe deserialization. Learn Python's json module with dumps, dump, loads, and load to serialize dictionaries and nested structures.
Explore Json serialization in Python by using the Json module with dumps and loads to convert dictionaries to Json strings, handle types, and address non-serializable objects with custom serialization.
Learn to serialize complex Python objects to JSON by implementing custom formatters, using ISO 8601 for datetimes, and applying single dispatch for extensible types.
Explore Python's json encoder and dumps options, including skip keys, indent, separators, and sort keys to control serialization. Create a json encoder by subclassing JsonEncoder to enforce consistency across dumps.
Explore customizing Json encoder in Python by subclassing the encoder, using dumps with a class, and encoding date times with iso format while delegating unknown types.
Learn to decode json in Python with loads and load, use a custom object_hook to deserialize date time and fractions via a defined schema, and handle nested structures.
Learn how to implement a custom json decoder by inheriting and overriding the decode method to parse the entire json string, using the class argument with load/loads for consistent deserialization.
Demonstrate serialization and deserialization with YAML using PyYAML, covering dictionaries, lists, and Python objects, and discuss safe_load versus load, pickle risks, and optional Marshmallow integration for object mapping.
Explore a fast one-way serialization library for Python, with schemas for person and movie objects, and compare it to marshmallow, including Json and Yaml outputs.
Learn how to implement a custom json encoder and decoder for serializing and deserializing stock and trade objects within an activity dictionary, with recursive decoding and equality checks.
Explore specialized dictionaries in the Python standard library, including default dict, ordered dict, counter, chain map, and user dict. Learn their behaviors, ordering, and use cases for custom dictionary types.
Explore defaultdict in Python by comparing get versus automatic key creation and counting character occurrences with defaultdict. Learn lambda factories and partials, and implement a decorator to track calls.
Explore dictionaries and the Counter from collections to maintain counters, update counts from others or iterables, and find the most common items.
Learn to build custom dictionaries in Python with user dict to enforce real numbers and truncation, compare with dict inheritance, implement a limited dict for red, green, blue keys 0–255.
Merge dictionaries to compute frequencies using defaultdict or counter, then count eye colors with zeros for missing values, and practice recursive chain map merging of common dev prod json configurations.
Learn to count eye colors with collections.Counter, ensuring zero counts for missing colors by pre initializing or merging zero values. Return results in most common order when needed.
Explore loading environment-specific JSON settings and merging them with common defaults by recursively merging nested dictionaries, using a recursive chain map approach to override values.
This course is an in-depth look at Python dictionaries.
Dictionaries are ubiquitous in Python. Classes are essentially dictionaries, modules are dictionaries, namespaces are dictionaries, sets are dictionaries and many more.
In this course we'll take an in-depth look at:
associative arrays and how they can be implemented using hash maps
hash functions and how we can leverage them for our own custom classes
Python dictionaries and sets and the various operations we can perform with them
specialized dictionary structures such as OrderedDict and how it relates to the built-in Python3.6+ dict
Python's implementation of multi-sets, the Counter class
the ChainMap class
how to create custom dictionaries by inheriting from the UserDict class
how to serialize and deserialize dictionaries to JSON
the use of schemas in custom JSON deserialization
a brief introduction to some useful libraries such as JSONSchema, PyYaml and Serpy
***** Prerequisites *****
Please note that this is a relatively advanced Python course, and a strong knowledge of some topics in Python is required.
Beyond the basics of Python (loops, conditional statements, exception handling, built-in data types, creating classes, etc), you should also have an in-depth understanding of the following topics:
functions and functional programming (recursion, *args, **kwargs, zip, map, sorted, any, all, etc)
lambdas, closures and decorators (including standard decorators such as @singledispatch, @wraps, etc)
iterables, iterators, generators and context managers
named tuples
variable scopes and namespaces (globals, locals, etc)
For this course you will also need to install some 3rd party libraries, so you need to be comfortable with doing this using the tool of your choice (e.g. pip, conda, etc)
Finally, most of the code in this course is illustrated using the freely available Jupyter Notebooks, so you will need that as well.