12 Imports and exports

This chapter covers

  • Importing JSON data
  • Flattening a nested collection of records
  • Downloading a CSV from an online website
  • Reading from and writing to Excel workbooks

Data sets come in a variety of file formats: comma-separated values (CSV), tab-separated values (TSV), Excel workbooks (XLSX), and more. Some data formats do not store data in tabular format; instead, they nest collections of related data inside a key-value store. Consider the following two examples. Figure 12.1 stores data in a table, and figure 12.2 stores the same data in a Python dictionary.

Figure 12.1 A table of Oscar winners

Python’s dictionary is ...

Get Pandas in Action now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.