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/09/22 21:47:52 UTC

[GitHub] [beam] TheNeuralBit commented on a change in pull request #12858: [BEAM-9547] Raise NotImplementedError and WontImplementError throughout DeferredDataframe

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



##########
File path: sdks/python/apache_beam/dataframe/frames.py
##########
@@ -279,13 +267,23 @@ def __getattr__(self, name):
 
   def __getitem__(self, key):
     # TODO: Replicate pd.DataFrame.__getitem__ logic
-    if (isinstance(key, list) and
-        all(key_column in self._expr.proxy().columns
-            for key_column in key)) or key in self._expr.proxy().columns:
+    if isinstance(key, frame_base.DeferredBase):
+      # Fail early if key is a DeferredBase as it interacts surprisingly with
+      # key in self._expr.proxy().columns
+      raise NotImplementedError(
+          "Indexing with a deferred frame is not yet supported. Consider "
+          "using df.loc[...]")
+
+    if (isinstance(key, list) and key_column in self._expr.proxy().columns

Review comment:
       Good catch, fixed

##########
File path: sdks/python/apache_beam/dataframe/frames.py
##########
@@ -763,8 +788,9 @@ def sort_values(self, axis, **kwargs):
   transform = frame_base._elementwise_method(
       'transform', restrictions={'axis': 0})
 
-  def transpose(self, *args, **kwargs):
-    raise frame_base.WontImplementError('non-deferred column values')
+  transpose = frame_base.wont_implement_method('non-deferred column values')
+  pivot = frame_base.wont_implement_method('non-deferred column values')

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