Data Structures
Explore Python's core data structures including lists, dictionaries, and sets, as well as generators for memory-efficient data handling. Understand how these structures are ordered, changeable, and used for data organization, which is essential for any data analysis task.
We'll cover the following...
We'll cover the following...
Lists in Python #
As mentioned in the previous section, lists are a useful data structure in Python. Lists are ordered, changeable, and allow for duplicates. You create a list with the [].
We can slice a list. Slicing means to extract a part of the list. When slicing, the first number is included in the return set while the last number is not. For example:
p1 = [1,2,3,4,5,6,7,8,9,10]
p2 = p1[0:5]
The list p2 will be [1,2,3,4,5]. Because we’ll start from 0th index of p1 ...