Chapter 10Report Generation
No investigation is complete without documenting and reporting results. The task of assembling experimental data and analysis results can be tedious, especially when a large amount of data is involved. Fortunately, many Python tools are available to make the job easier by automating the repetitive data assembly, visualization, and results dissemination.
Numerous Python modules provide simple programming interfaces that enable the programmatic generation of documents, presentations, and spreadsheets. In this chapter, we will introduce several modules for creating Microsoft Word, PowerPoint, and PDF documents. In Section 7.6, we introduced the openpyxl module, which can be used to create and programmatically populate Excel files.
Once generated, reports are often shared with colleagues. One convenient way to share reports is to deliver them through email. Another is to offer report downloads through a web browser. We’ll close this chapter with an introduction to the standards that form the basis for email and demonstrate how Python’s native modules are used to attach and email documents. We’ll also demonstrate how to start a built-in Python HTTP server, which can be used by others to access and download files from a remote computer.
10.1 BytesIO Object
The reports that we generate will include several images, especially those obtained from plotting data. We could save generated plots to temporary image files and then read the data back out of the ...
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.
Read now
Unlock full access