def _gotitem(self, key, ndim, subset=None):
self._set_binner()<EOL>grouper = self.grouper<EOL>if subset is None:<EOL><INDENT>subset = self.obj<EOL><DEDENT>grouped = groupby(subset, by=None, grouper=grouper, axis=self.axis)<EOL>try:<EOL><INDENT>return grouped[key]<EOL><DEDENT>except KeyError:<EOL><INDENT>return grouped<EOL><DEDENT>
Sub-classes to define. Return a sliced object.

Parameters
----------
key : string / list of selections
ndim : 1,2
    requested ndim of result
subset : object, default None
    subset to act on