Skip to content

Instantly share code, notes, and snippets.

@JnsFerreira
Created February 1, 2021 23:52
Show Gist options
  • Save JnsFerreira/9a2abfa0dde0e02bde804c949e310fbc to your computer and use it in GitHub Desktop.
Save JnsFerreira/9a2abfa0dde0e02bde804c949e310fbc to your computer and use it in GitHub Desktop.
Using map in Apache Beam
import apache_beam as beam
with beam.Pipeline() as pipeline:
plants = (
pipeline
| 'Gardening plants' >> beam.Create([
' 🍓Strawberry \n',
' 🥕Carrot \n',
' 🍆Eggplant \n',
' 🍅Tomato \n',
' 🥔Potato \n',
])
| 'Strip' >> beam.Map(str.strip)
| beam.Map(print))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment