Academy
1/6
Python for data, the basics

Lesson 4 of 5 · 8 min

Tables as lists of dictionaries

A dictionary stores values under names, called keys, inside curly brackets. One dictionary is a good fit for one row of a table: the keys are the column names.

farm = {"id": "F03", "state": "Benue", "crop": "yam", "tonnes": 30}

print(farm["crop"])   # yam
Dictionary
Values stored under keys, like {"crop": "yam"}. Read one with farm["crop"].
Saved to your glossary
or press Enter