[ https://issues.apache.org/jira/browse/BEAM-7389?focusedWorklogId=285220&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-285220 ]
ASF GitHub Bot logged work on BEAM-7389: ---------------------------------------- Author: ASF GitHub Bot Created on: 30/Jul/19 19:53 Start Date: 30/Jul/19 19:53 Worklog Time Spent: 10m Work Description: rosetn commented on pull request #9184: [BEAM-7389] Add code examples for Filter page URL: https://github.com/apache/beam/pull/9184#discussion_r308858792 ########## File path: website/src/documentation/transforms/python/element-wise/filter.md ########## @@ -18,25 +18,168 @@ See the License for the specific language governing permissions and limitations under the License. --> -# Filter -<table align="left"> - <a target="_blank" class="button" +# Filter + +<script type="text/javascript"> +localStorage.setItem('language', 'language-py') +</script> + +<table> + <td> + <a class="button" target="_blank" href="https://beam.apache.org/releases/pydoc/current/apache_beam.transforms.core.html#apache_beam.transforms.core.Filter"> - <img src="https://beam.apache.org/images/logos/sdks/python.png" width="20px" height="20px" - alt="Pydoc" /> - Pydoc + <img src="https://beam.apache.org/images/logos/sdks/python.png" + width="20px" height="20px" alt="Pydoc" /> + Pydoc </a> + </td> </table> <br> + Given a predicate, filter out all elements that don't satisfy that predicate. May also be used to filter based on an inequality with a given value based on the comparison ordering of the element. ## Examples -See [BEAM-7389](https://issues.apache.org/jira/browse/BEAM-7389) for updates. -## Related transforms +### Function + +`Filter` accepts a function that receives the element as the first argument, +and returns `True` if the element will be kept, or `False` if the element will be filtered out. + +```py +{% github_sample /apache/beam/blob/master/sdks/python/apache_beam/examples/snippets/transforms/element_wise/filter.py tag:filter_function %}``` + +<table> + <td> + <a class="button" target="_blank" + href="https://github.com/apache/beam/blob/master/sdks/python/apache_beam/examples/snippets/transforms/element_wise/filter.py"> + <img src="https://www.tensorflow.org/images/GitHub-Mark-32px.png" + width="20px" height="20px" alt="View on GitHub" /> + View on GitHub + </a> + </td> +</table> +<br> + +### Lambda Review comment: Replace with "### Example 2: Filtering with a lambda function" ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org Issue Time Tracking ------------------- Worklog Id: (was: 285220) Time Spent: 24h 10m (was: 24h) > Colab examples for element-wise transforms (Python) > --------------------------------------------------- > > Key: BEAM-7389 > URL: https://issues.apache.org/jira/browse/BEAM-7389 > Project: Beam > Issue Type: Improvement > Components: website > Reporter: Rose Nguyen > Assignee: David Cavazos > Priority: Minor > Time Spent: 24h 10m > Remaining Estimate: 0h > -- This message was sent by Atlassian JIRA (v7.6.14#76016)