9.3 Using stacked generator expressions
In the Writing generator functions with the yield statement recipe earlier in this chapter, we created a simple generator function that performed a single transformation on a piece of data. As a practical matter, we often have several functions that we’d like to apply to incoming data.
How can we stack or combine multiple generator functions to create a composite function?
9.3.1 Getting ready
This recipe will apply several different kinds of transformations to source data. There will be restructuring of the rows to combine three rows into a single row, data conversions to convert the source strings into useful numbers or datetime stamps, and filtering to reject rows that aren’t useful.
We have a spreadsheet that is used to record fuel consumption on a large sailboat.
For details of this data, see the Slicing and dicing a list recipe in Chapter 4. We’ll look...