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



##########
File path: sdks/python/apache_beam/dataframe/pandas_top_level_functions.py
##########
@@ -38,8 +38,14 @@ def wrapper(target, *args, **kwargs):
 
 
 def _defer_to_pandas(name):
+  func = getattr(pd, name)
+
   def wrapper(*args, **kwargs):
-    res = getattr(pd, name)(*args, **kwargs)
+    if any(isinstance(arg, frame_base.DeferredBase)
+           for arg in args + tuple(kwargs.values())):
+      return frame_base._elementwise_function(func, name)(*args, **kwargs)

Review comment:
       I guess there's a concern that a top-level function might not operate 
element-wise on pandas args. I could make this a separate function, e.g. 
`_defer_to_pandas_elementwise` (and while I'm at it look over the other 
`_defer_to_pandas` usages and see if they should be switched).




----------------------------------------------------------------
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:
[email protected]


Reply via email to