Values

Pydoc Pydoc




Takes a collection of key-value pairs, and returns the value of each element.

Example

In the following example, we create a pipeline with a PCollection of key-value pairs. Then, we apply Values to extract the values and discard the keys.

import apache_beam as beam

with beam.Pipeline() as pipeline:
  plants = (
      pipeline
      | 'Garden plants' >> beam.Create([
          ('🍓', 'Strawberry'),
          ('🥕', 'Carrot'),
          ('🍆', 'Eggplant'),
          ('🍅', 'Tomato'),
          ('🥔', 'Potato'),
      ])
      | 'Values' >> beam.Values()
      | beam.Map(print)
  )

Output PCollection after Values:

Strawberry
Carrot
Eggplant
Tomato
Potato
Run code now Run code now
View source code View source code




Pydoc Pydoc