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?
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 date-time 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. It has rows that look like this:
Date |
... |