Repository: pandas-dev/pandas

Issue:
CLN: Remove unused code in groupby.py
```bash
williams-mbp:pandas williamayd$ vulture pandas | grep "pandas/core/groupby.py"
pandas/core/groupby.py:947: unused function '_index_with_as_index' (60% confidence)
pandas/core/groupby.py:2280: unused function '_max_groupsize' (60% confidence)
pandas/core/groupby.py:2927: unused attribute '_should_compress' (60% confidence)
pandas/core/groupby.py:4940: unused class 'NDArrayGroupBy' (60% confidence)
pandas/core/groupby.py:4996: unused class 'ArraySplitter' (60% confidence)
```

Grepping the pandas directory for these items individual yields no uses outside of their initial declaration. Should be safe to remove and start cleaning up the module


Discussion:

Resolving patch:
diff --git a/pandas/core/groupby.py b/pandas/core/groupby.py
--- a/pandas/core/groupby.py
+++ b/pandas/core/groupby.py
@@ -944,23 +944,6 @@ def _cumcount_array(self, ascending=True):
         rev[sorter] = np.arange(count, dtype=np.intp)
         return out[rev].astype(np.int64, copy=False)
 
-    def _index_with_as_index(self, b):
-        """
-        Take boolean mask of index to be returned from apply, if as_index=True
-
-        """
-        # TODO perf, it feels like this should already be somewhere...
-        from itertools import chain
-        original = self._selected_obj.index
-        gp = self.grouper
-        levels = chain((gp.levels[i][gp.labels[i][b]]
-                        for i in range(len(gp.groupings))),
-                       (original._get_level_values(i)[b]
-                        for i in range(original.nlevels)))
-        new = MultiIndex.from_arrays(list(levels))
-        new.names = gp.names + original.names
-        return new
-
     def _try_cast(self, result, obj, numeric_only=False):
         """
         try to cast the result to our obj original type,
@@ -2295,18 +2278,6 @@ def size(self):
                       index=self.result_index,
                       dtype='int64')
 
-    @cache_readonly
-    def _max_groupsize(self):
-        """
-        Compute size of largest group
-        """
-        # For many items in each group this is much faster than
-        # self.size().max(), in worst case marginally slower
-        if self.indices:
-            return max(len(v) for v in self.indices.values())
-        else:
-            return 0
-
     @cache_readonly
     def groups(self):
         """ dict {group name -> group labels} """
@@ -2941,9 +2912,6 @@ def __init__(self, index, grouper=None, obj=None, name=None, level=None,
         if isinstance(grouper, MultiIndex):
             self.grouper = grouper.values
 
-        # pre-computed
-        self._should_compress = True
-
         # we have a single grouper which may be a myriad of things,
         # some of which are dependent on the passing in level
 
@@ -4964,10 +4932,6 @@ def _wrap_aggregated_output(self, output, names=None):
         raise com.AbstractMethodError(self)
 
 
-class NDArrayGroupBy(GroupBy):
-    pass
-
-
 # ----------------------------------------------------------------------
 # Splitting / application
 
@@ -5020,10 +4984,6 @@ def apply(self, f):
         raise com.AbstractMethodError(self)
 
 
-class ArraySplitter(DataSplitter):
-    pass
-
-
 class SeriesSplitter(DataSplitter):
 
     def _chop(self, sdata, slice_obj):


Test patch: