You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@beam.apache.org by "robertwb (via GitHub)" <gi...@apache.org> on 2023/03/22 22:14:54 UTC

[GitHub] [beam] robertwb commented on a diff in pull request #25919: Allow PTransforms to be applied directly to dataframes.

robertwb commented on code in PR #25919:
URL: https://github.com/apache/beam/pull/25919#discussion_r1145462426


##########
sdks/python/apache_beam/dataframe/frames.py:
##########
@@ -5394,6 +5396,24 @@ def func(df, *args, **kwargs):
         frame_base._elementwise_method(inplace_name, inplace=True,
                                        base=pd.DataFrame))
 
+# Allow dataframe | SchemaTransform
+def _create_maybe_elementwise_or(base):
+  elementwise = frame_base._elementwise_method(
+      '__or__', restrictions={'level': None}, base=base)
+
+  def _maybe_elementwise_or(self, right):
+    if isinstance(right, PTransform):
+      return convert.to_dataframe(convert.to_pcollection(self) | right)

Review Comment:
   Added a note. Once we push the batching stuff through, there could be little to no overhead here, but that's future work. 



-- 
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.

To unsubscribe, e-mail: github-unsubscribe@beam.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org