Collections of Data#

We have looked at how Python can store and manipulate data one element at a time; next wee need the ability to store and manipulate many elements at once. Data structures organize data, and choosing the right kind of data structure can make some parts of our analysis particularly simple. Python and its libraries provide many ways to group data together. In this chapter and the next we will discuss some important ones:

  • Lists

  • Dictionaries

  • (numpy) Arrays

  • (pandas) DataFrames (discussed in Chapter 6)

The above are listed in order of increasing functionality and sophistication and, in general, you should use the simplest one that meets your needs.