Skip to main content

Dictionaries

  • Chapter
  • 188k Accesses

Abstract

In addition to integers, floats, strings, and lists, Python has a powerful built-in Python data type called a dictionary. Dictionaries are useful for storing tables of information with a unique identifier for each record. Dictionaries provide a mapping from a set of keys to a set of values. In other words, given a key, a dictionary can look up the value associated with it. These have many applications in GIS, including reading GIS attribute tables or text data files and modifying them within a script. Also, they are often used to store pairs of items that go together. For example, soil science uses standard classifications for soil, abbreviated with terms such as ‘Ap’ and ‘Cg’; However, more explicit names such as ‘Plinthic Acrisol’ (for ‘Ap’) and ‘Gleyic Chernozem’ (for ‘Cg’) are needed for some analysis. A dictionary can be used to store these terms so that the abbreviations are associated with the full names. This chapter shows the dictionary syntax for creating associations like this and then it shows how to access, update, and modify dictionaries.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   69.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   89.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info
Hardcover Book
USD   119.99
Price excludes VAT (USA)
  • Durable hardcover edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2015 Springer International Publishing Switzerland

About this chapter

Cite this chapter

Tateosian, L. (2015). Dictionaries. In: Python For ArcGIS. Springer, Cham. https://doi.org/10.1007/978-3-319-18398-5_18

Download citation

Publish with us

Policies and ethics