Skip to Content
Practical Time Series Analysis
book

Practical Time Series Analysis

by PKS Prakash, Avishek Pal
September 2017
Beginner
244 pages
5h 20m
English
Packt Publishing
Content preview from Practical Time Series Analysis

Maps

Python supports hashmaps or associative arrays. Every element in a hashmap is associated with a definition or key. Dict is the basic hashmap implementation in Python. The elements in a dict are called values, which are mapped to references known as keys. A dict can be instantiated from an iterable of key-value pairs. This iterable can be a list, tuple, or an iterator, which we will discuss in one of the upcoming sections. The following code snippet shows multiple ways to create a dict:

mydict = dict([(0,1), (1,2), (2,3), (3,4), (4,5)])mydict = dict([[0,1], [1,2], [2,3], [3,4], [4,5]])mydict = {0:1, 1:2, 2:3, 3:4, 4:5}

Elements from a dict can be retrieved by invoking the get method that takes the key as input. Another way is to use ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Practical Time Series Analysis

Practical Time Series Analysis

Aileen Nielsen

Publisher Resources

ISBN: 9781788290227Supplemental Content