Skip to content

Commit

Permalink
LuxSeriesGroupBy apply bugfix (#390)
Browse files Browse the repository at this point in the history
* bugfix LuxSeriesGroupBy

* black
  • Loading branch information
dorisjlee committed Jun 25, 2021
1 parent a4beac2 commit 29e0c70
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 13 deletions.
6 changes: 0 additions & 6 deletions lux/core/frame.py
Original file line number Diff line number Diff line change
Expand Up @@ -851,12 +851,6 @@ def tail(self, n: int = 5):
ret_val._history.append_event("tail", n=5)
return ret_val

def describe(self, *args, **kwargs):
ret_val = super(LuxDataFrame, self).describe(*args, **kwargs)
ret_val._pandas_only = True
ret_val._history.append_event("describe", *args, **kwargs)
return ret_val

def groupby(self, *args, **kwargs):
history_flag = False
if "history" not in kwargs or ("history" in kwargs and kwargs["history"]):
Expand Down
7 changes: 0 additions & 7 deletions lux/core/groupby.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,6 @@ def apply(self, *args, **kwargs):
ret_val.pre_aggregated = False # Returned LuxDataFrame isn't pre_aggregated
return ret_val

def apply(self, *args, **kwargs):
ret_val = super(LuxDataFrameGroupBy, self).apply(*args, **kwargs)
for attr in self._metadata:
ret_val.__dict__[attr] = getattr(self, attr, None)
ret_val.pre_aggregated = False # Returned LuxDataFrame isn't pre_aggregated
return ret_val

def size(self, *args, **kwargs):
ret_val = super(LuxGroupBy, self).size(*args, **kwargs)
for attr in self._metadata:
Expand Down
7 changes: 7 additions & 0 deletions tests/test_pandas.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,13 @@ def test_describe(global_var):
assert len(summary.columns) == 10


def test_groupby_describe(global_var):
df = pytest.college_df
result = df.groupby("FundingModel")["AdmissionRate"].describe()
result._ipython_display_()
assert result.shape == (3, 8)


def test_convert_dtype(global_var):
df = pytest.college_df
cdf = df.convert_dtypes()
Expand Down

0 comments on commit 29e0c70

Please sign in to comment.