[ https://issues.apache.org/jira/browse/BEAM-7389?focusedWorklogId=293397&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-293397 ]
ASF GitHub Bot logged work on BEAM-7389: ---------------------------------------- Author: ASF GitHub Bot Created on: 12/Aug/19 21:20 Start Date: 12/Aug/19 21:20 Worklog Time Spent: 10m Work Description: davidcavazos commented on pull request #9289: [BEAM-7389] Add code examples for ToString page URL: https://github.com/apache/beam/pull/9289#discussion_r313133987 ########## File path: website/src/documentation/transforms/python/element-wise/tostring.md ########## @@ -19,9 +19,38 @@ limitations under the License. --> # ToString + +<script type="text/javascript"> +localStorage.setItem('language', 'language-py') +</script> + Transforms every element in an input collection a string. -## Examples -See [BEAM-7389](https://issues.apache.org/jira/browse/BEAM-7389) for updates. +## Example + +Any non-string element can be converted to a string using sandard Python functions and methods. +Many I/O transforms such as `TextIO` expect their input elements to be strings. + +```py +{% github_sample /apache/beam/blob/master/sdks/python/apache_beam/examples/snippets/transforms/element_wise/to_string.py tag:to_string %}``` + +Output `PCollection` after *to string*: Review comment: I just removed the "after to string" part. I'm hesitant to say that it's the output of the *pipeline* because the `print` function returns `None`, so the output to the pipeline is actually a `PCollection` of all `None`s. For testing we hack around that by mocking the print function to use `lambda element: element`. ---------------------------------------------------------------- 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: 293397) Time Spent: 42h 40m (was: 42.5h) > 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: 42h 40m > Remaining Estimate: 0h > -- This message was sent by Atlassian JIRA (v7.6.14#76016)