You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by GitBox <gi...@apache.org> on 2020/10/08 18:24:07 UTC

[GitHub] [beam] TheNeuralBit commented on a change in pull request #12705: [BEAM-10720] Finish implementing StringMethods (cat, repeat)

TheNeuralBit commented on a change in pull request #12705:
URL: https://github.com/apache/beam/pull/12705#discussion_r501925345



##########
File path: sdks/python/apache_beam/dataframe/transforms_test.py
##########
@@ -266,6 +266,18 @@ def check(actual):
           lambda x: {'res': 3 * x}, proxy)
       assert_that(res['res'], equal_to_series(three_series), 'CheckDictOut')
 
+  def test_cat(self):
+    # verify that cat works with a List[Series] sicne this is

Review comment:
       Done

##########
File path: sdks/python/apache_beam/dataframe/frames.py
##########
@@ -905,7 +905,48 @@ def checked_callable_index(df):
             preserves_partition_by=partitionings.Singleton()))
 
 class _DeferredStringMethods(frame_base.DeferredBase):
-  pass
+  @frame_base.args_to_kwargs(pd.core.strings.StringMethods)
+  @frame_base.populate_defaults(pd.core.strings.StringMethods)
+  def cat(self, others, join, **kwargs):
+    if others is None:
+      # Concatenate series into a single String
+      requires = partitionings.Singleton()
+      func = lambda df: df.cat(join=join, **kwargs)
+      args = [self._expr]
+
+    elif isinstance(others, frame_base.DeferredBase) or \

Review comment:
       Done




----------------------------------------------------------------
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:
users@infra.apache.org