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 2021/02/19 00:52:12 UTC

[GitHub] [beam] robertwb commented on a change in pull request #13932: [BEAM-9547] Fill in some trivial compliance gaps

robertwb commented on a change in pull request #13932:
URL: https://github.com/apache/beam/pull/13932#discussion_r578848101



##########
File path: sdks/python/apache_beam/dataframe/frames.py
##########
@@ -95,7 +138,13 @@ def fillna(self, value, method, axis, **kwargs):
   def ffill(self, **kwargs):
     return self.fillna(method='ffill', **kwargs)
 
+  @frame_base.args_to_kwargs(pd.DataFrame)
+  @frame_base.populate_defaults(pd.DataFrame)
+  def bfill(self, **kwargs):
+    return self.fillna(method='bfill', **kwargs)

Review comment:
       This method is order sensitive, right? 

##########
File path: sdks/python/apache_beam/dataframe/frames.py
##########
@@ -239,6 +288,36 @@ def __getitem__(self, key):
       # be more surprising than a clear error.
       raise frame_base.WontImplementError('non-deferred')
 
+  def keys(self):
+    return self.index
+
+  @frame_base.args_to_kwargs(pd.Series)
+  @frame_base.populate_defaults(pd.Series)
+  def append(self, to_append, ignore_index, verify_integrity, **kwargs):
+    if not isinstance(to_append, DeferredSeries):
+      raise frame_base.WontImplementError(
+          "append() only accepts DeferredSeries instances, received " +
+          str(type(to_append)))
+    if ignore_index:
+      raise frame_base.WontImplementError(
+          "append(ignore_index=True) is order sensitive")
+
+    if verify_integrity:
+      # verifying output has a unique index requires global index.
+      requires = partitionings.Singleton()

Review comment:
       Just a thought: it might be nice to attach a message as to why we chose Singleton here (that we could use when throwing an error). Fine with a TODO/JIRA. 

##########
File path: sdks/python/apache_beam/dataframe/frames_test.py
##########
@@ -405,6 +440,19 @@ def test_series_agg(self):
       self._run_test(lambda s: s.agg(['mean']), s)
       self._run_test(lambda s: s.agg('mean'), s)
 
+  def test_append_sort(self):
+    df1 = pd.DataFrame({'int': [1, 2, 3], 'str': ['a', 'b', 'c']},

Review comment:
       You can tag a line with `# yapf: disable`




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