Mean
Pydoc |
Transforms for computing the arithmetic mean of the elements in a collection, or the mean of the values associated with each key in a collection of key-value pairs.
Examples
In the following example, we create a pipeline with a PCollection
.
Then, we get the element with the average value in different ways.
Example 1: Mean of element in a PCollection
We use Mean.Globally()
to get the average of the elements from the entire PCollection
.
Example 2: Mean of elements for each key
We use Mean.PerKey()
to get the average of the elements for each unique key in a PCollection
of key-values.
Related transforms
Pydoc |
Last updated on 2024/11/14
Have you found everything you were looking for?
Was it all useful and clear? Is there anything that you would like to change? Let us know!