From aa5daa1b82261417fd858cb8519e6290c42e4f03 Mon Sep 17 00:00:00 2001 From: Kunal Gosar Date: Thu, 21 Jun 2018 08:25:32 -0700 Subject: [PATCH] fixing zero length partitions (#2237) fixing bugs to fully handle zero len parts resolve comments renaming imports Add getattr to groupby testing --- python/ray/dataframe/groupby.py | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/python/ray/dataframe/groupby.py b/python/ray/dataframe/groupby.py index 2a3100075..39862d94d 100644 --- a/python/ray/dataframe/groupby.py +++ b/python/ray/dataframe/groupby.py @@ -62,6 +62,25 @@ class DataFrameGroupBy(object): else: self._grouped_partitions = [df._row_partitions] + def __getattr__(self, key): + """Afer regular attribute access, looks up the name in the columns + + Args: + key (str): Attribute name. + + Returns: + The value of the attribute. + """ + try: + return object.__getattribute__(self, key) + except AttributeError as e: + if key in self._columns: + raise NotImplementedError( + "SeriesGroupBy is not implemented." + "To contribute to Pandas on Ray, please visit " + "github.com/ray-project/ray.") + raise e + @property def _iter(self): from .dataframe import DataFrame