diff --git a/pandas/core/groupby/base.py b/pandas/core/groupby/base.py index a148f7e0cab87..ebba4a0a9395d 100644 --- a/pandas/core/groupby/base.py +++ b/pandas/core/groupby/base.py @@ -69,35 +69,22 @@ def _gotitem(self, key, ndim, subset=None): # special case to prevent duplicate plots when catching exceptions when # forwarding methods from NDFrames -plotting_methods = frozenset(['plot', 'boxplot', 'hist']) +plotting_methods = frozenset(['plot', 'hist']) common_apply_whitelist = frozenset([ - 'last', 'first', - 'head', 'tail', 'median', - 'mean', 'sum', 'min', 'max', - 'cumcount', 'ngroup', - 'resample', - 'rank', 'quantile', - 'fillna', - 'mad', - 'any', 'all', - 'take', - 'idxmax', 'idxmin', - 'shift', 'tshift', - 'ffill', 'bfill', - 'pct_change', 'skew', - 'corr', 'cov', 'diff', + 'quantile', 'fillna', 'mad', 'take', + 'idxmax', 'idxmin', 'tshift', + 'skew', 'corr', 'cov', 'diff' ]) | plotting_methods series_apply_whitelist = ((common_apply_whitelist | {'nlargest', 'nsmallest', 'is_monotonic_increasing', - 'is_monotonic_decreasing'}) - - {'boxplot'}) | frozenset(['dtype', 'unique']) + 'is_monotonic_decreasing'}) + ) | frozenset(['dtype', 'unique']) dataframe_apply_whitelist = ((common_apply_whitelist | - frozenset(['dtypes', 'corrwith'])) - - {'boxplot'}) + frozenset(['dtypes', 'corrwith']))) cython_transforms = frozenset(['cumprod', 'cumsum', 'shift', 'cummin', 'cummax']) diff --git a/pandas/tests/groupby/test_whitelist.py b/pandas/tests/groupby/test_whitelist.py index e0f1730d6909f..a451acebcdba4 100644 --- a/pandas/tests/groupby/test_whitelist.py +++ b/pandas/tests/groupby/test_whitelist.py @@ -14,35 +14,16 @@ AGG_FUNCTIONS_WITH_SKIPNA = ['skew', 'mad'] df_whitelist = [ - 'last', - 'first', - 'mean', - 'sum', - 'min', - 'max', - 'head', - 'tail', - 'cumcount', - 'ngroup', - 'resample', - 'rank', 'quantile', 'fillna', 'mad', - 'any', - 'all', 'take', 'idxmax', 'idxmin', - 'shift', 'tshift', - 'ffill', - 'bfill', - 'pct_change', 'skew', 'plot', 'hist', - 'median', 'dtypes', 'corrwith', 'corr', @@ -57,35 +38,16 @@ def df_whitelist_fixture(request): s_whitelist = [ - 'last', - 'first', - 'mean', - 'sum', - 'min', - 'max', - 'head', - 'tail', - 'cumcount', - 'ngroup', - 'resample', - 'rank', 'quantile', 'fillna', 'mad', - 'any', - 'all', 'take', 'idxmax', 'idxmin', - 'shift', 'tshift', - 'ffill', - 'bfill', - 'pct_change', 'skew', 'plot', 'hist', - 'median', 'dtype', 'corr', 'cov', @@ -150,17 +112,8 @@ def test_groupby_whitelist(df_letters, whitelist): def check_whitelist(obj, df, m): # check the obj for a particular whitelist m - # these are aliases so ok to have the alias __name__ - alias = {'bfill': 'backfill', - 'ffill': 'pad', - 'boxplot': None} - gb = obj.groupby(df.letters) - m = alias.get(m, m) - if m is None: - return - f = getattr(type(gb), m) # name