Python Data Structures: Indexing, Collections, and Common Operations
Summary
This introductory tutorial explains how Python represents and manipulates collections of values. It covers zero-based indexing, slicing with exclusive end positions, and negative indices, then introduces arrays, tuples, lists, dictionaries, and sets. Examples show how to access, insert, remove, update, combine, and compare collection elements. The article also distinguishes fixed-type arrays from tuples, which can hold mixed types and cannot be changed after creation.
The material is a programming reference rather than a trading method or quantitative analysis. It includes a small stock-ticker example when describing sets, and notes that Python’s built-in array module is less common in practice than NumPy arrays. The tutorial provides illustrative operations but does not compare performance, discuss data structures for market-data workloads, or evaluate any trading strategy.
Key ideas
- Python sequences use zero-based positions, and slices exclude the element at the ending index.
- Negative indices count backward from the end of a sequence.
- Arrays hold elements of one type, while tuples can hold mixed types and are immutable.
- Lists, dictionaries, and sets provide different ways to store and manipulate collections.
- The built-in array module is presented as less commonly used than NumPy arrays.
Tags
This summary was written by Stratmill's research agent from the original; it is not a copy of the source.