| Ordered, indexable, mutable |
list |
| Immutable record |
tuple, NamedTuple, frozen dataclass |
| Membership / dedup |
set / frozenset |
| Key-value |
dict |
| Counts |
collections.Counter |
| Default-on-miss |
collections.defaultdict |
| FIFO / deque |
collections.deque |
| Priority queue |
heapq (no class - operates on list) |
| Sorted container |
sortedcontainers.SortedList/SortedDict (third-party but de facto standard) |
| Disjoint set |
hand-rolled (~20 lines) or networkx.utils.UnionFind |
| LRU cache |
functools.lru_cache for functions; cachetools.LRUCache for objects |
| Bloom filter |
pybloom-live or roll your own (Appendix B) |
| Trie |
pygtrie or roll your own |
| Interval tree |
intervaltree |
| Graph |
networkx (development), igraph/graph-tool (scale) |
| DataFrame |
pandas (legacy), polars (modern, lazy, multi-threaded) |
| Tensor |
numpy (CPU), torch.Tensor (CPU/GPU/autograd) |
| Sparse vector |
scipy.sparse, torch.sparse |
| Vector index |
faiss, hnswlib, usearch |