uploading chapter 9 source code
This commit is contained in:
@@ -0,0 +1,18 @@
|
||||
#pipeline2.py: Separate subject with grade from a PCollection
|
||||
import apache_beam as beam
|
||||
|
||||
def my_format(sub, marks):
|
||||
yield '{}\t{}'.format(sub,marks)
|
||||
|
||||
with beam.Pipeline() as pipeline:
|
||||
plants = (
|
||||
pipeline
|
||||
| 'Subjects' >> beam.Create([
|
||||
('English','A'),
|
||||
('Maths', 'B+'),
|
||||
('Science', 'A-'),
|
||||
('French', 'A'),
|
||||
('Arts', 'A+'),
|
||||
])
|
||||
| 'Format subjects with marks' >> beam.FlatMapTuple(my_format)
|
||||
| beam.Map(print))
|
||||
Reference in New Issue
Block a user