nodes: 0, module; 1, function_definition; 2, function_name:groupby; 3, parameters; 4, block; 5, identifier:self; 6, default_parameter; 7, default_parameter; 8, default_parameter; 9, default_parameter; 10, default_parameter; 11, default_parameter; 12, default_parameter; 13, default_parameter; 14, dictionary_splat_pattern; 15, expression_statement; 16, import_from_statement; 17, if_statement; 18, expression_statement; 19, return_statement; 20, identifier:by; 21, None; 22, identifier:axis; 23, integer:0; 24, identifier:level; 25, None; 26, identifier:as_index; 27, True; 28, identifier:sort; 29, True; 30, identifier:group_keys; 31, True; 32, identifier:squeeze; 33, False; 34, identifier:observed; 35, False; 36, identifier:kwargs; 37, comment:"""
          Group DataFrame or Series using a mapper or by a Series of columns.
  
          A groupby operation involves some combination of splitting the
          object, applying a function, and combining the results. This can be
          used to group large amounts of data and compute operations on these
          groups.
  
          Parameters
          ----------
          by : mapping, function, label, or list of labels
              Used to determine the groups for the groupby.
              If ``by`` is a function, it's called on each value of the object's
              index. If a dict or Series is passed, the Series or dict VALUES
              will be used to determine the groups (the Series' values are first
              aligned; see ``.align()`` method). If an ndarray is passed, the
              values are used as-is determine the groups. A label or list of
              labels may be passed to group by the columns in ``self``. Notice
              that a tuple is interpreted a (single) key.
          axis : {0 or 'index', 1 or 'columns'}, default 0
              Split along rows (0) or columns (1).
          level : int, level name, or sequence of such, default None
              If the axis is a MultiIndex (hierarchical), group by a particular
              level or levels.
          as_index : bool, default True
              For aggregated output, return object with group labels as the
              index. Only relevant for DataFrame input. as_index=False is
              effectively "SQL-style" grouped output.
          sort : bool, default True
              Sort group keys. Get better performance by turning this off.
              Note this does not influence the order of observations within each
              group. Groupby preserves the order of rows within each group.
          group_keys : bool, default True
              When calling apply, add group keys to index to identify pieces.
          squeeze : bool, default False
              Reduce the dimensionality of the return type if possible,
              otherwise return a consistent type.
          observed : bool, default False
              This only applies if any of the groupers are Categoricals.
              If True: only show observed values for categorical groupers.
              If False: show all values for categorical groupers.
  
              .. versionadded:: 0.23.0
  
          **kwargs
              Optional, only accepts keyword argument 'mutated' and is passed
              to groupby.
  
          Returns
          -------
          DataFrameGroupBy or SeriesGroupBy
              Depends on the calling object and returns groupby object that
              contains information about the groups.
  
          See Also
          --------
          resample : Convenience method for frequency conversion and resampling
              of time series.
  
          Notes
          -----
          See the `user guide
          <http://pandas.pydata.org/pandas-docs/stable/groupby.html>`_ for more.
  
          Examples
          --------
          >>> df = pd.DataFrame({'Animal': ['Falcon', 'Falcon',
          ...                               'Parrot', 'Parrot'],
          ...                    'Max Speed': [380., 370., 24., 26.]})
          >>> df
             Animal  Max Speed
          0  Falcon      380.0
          1  Falcon      370.0
          2  Parrot       24.0
          3  Parrot       26.0
          >>> df.groupby(['Animal']).mean()
                  Max Speed
          Animal
          Falcon      375.0
          Parrot       25.0
  
          **Hierarchical Indexes**
  
          We can groupby different levels of a hierarchical index
          using the `level` parameter:
  
          >>> arrays = [['Falcon', 'Falcon', 'Parrot', 'Parrot'],
          ...           ['Captive', 'Wild', 'Captive', 'Wild']]
          >>> index = pd.MultiIndex.from_arrays(arrays, names=('Animal', 'Type'))
          >>> df = pd.DataFrame({'Max Speed': [390., 350., 30., 20.]},
          ...                   index=index)
          >>> df
                          Max Speed
          Animal Type
          Falcon Captive      390.0
                 Wild         350.0
          Parrot Captive       30.0
                 Wild          20.0
          >>> df.groupby(level=0).mean()
                  Max Speed
          Animal
          Falcon      370.0
          Parrot       25.0
          >>> df.groupby(level=1).mean()
                   Max Speed
          Type
          Captive      210.0
          Wild         185.0
          """; 38, dotted_name; 39, dotted_name; 40, boolean_operator; 41, block; 42, assignment; 43, call; 44, identifier:pandas; 45, identifier:core; 46, identifier:groupby; 47, identifier:groupby; 48, identifier:groupby; 49, comparison_operator:level is None; 50, comparison_operator:by is None; 51, raise_statement; 52, identifier:axis; 53, call; 54, identifier:groupby; 55, argument_list; 56, identifier:level; 57, None; 58, identifier:by; 59, None; 60, call; 61, attribute; 62, argument_list; 63, identifier:self; 64, keyword_argument; 65, keyword_argument; 66, keyword_argument; 67, keyword_argument; 68, keyword_argument; 69, keyword_argument; 70, keyword_argument; 71, keyword_argument; 72, dictionary_splat; 73, identifier:TypeError; 74, argument_list; 75, identifier:self; 76, identifier:_get_axis_number; 77, identifier:axis; 78, identifier:by; 79, identifier:by; 80, identifier:axis; 81, identifier:axis; 82, identifier:level; 83, identifier:level; 84, identifier:as_index; 85, identifier:as_index; 86, identifier:sort; 87, identifier:sort; 88, identifier:group_keys; 89, identifier:group_keys; 90, identifier:squeeze; 91, identifier:squeeze; 92, identifier:observed; 93, identifier:observed; 94, identifier:kwargs; 95, string:"You have to supply one of 'by' and 'level'"
code: def groupby(self, by=None, axis=0, level=None, as_index=True, sort=True,
                  group_keys=True, squeeze=False, observed=False, **kwargs):
          """
          Group DataFrame or Series using a mapper or by a Series of columns.
  
          A groupby operation involves some combination of splitting the
          object, applying a function, and combining the results. This can be
          used to group large amounts of data and compute operations on these
          groups.
  
          Parameters
          ----------
          by : mapping, function, label, or list of labels
              Used to determine the groups for the groupby.
              If ``by`` is a function, it's called on each value of the object's
              index. If a dict or Series is passed, the Series or dict VALUES
              will be used to determine the groups (the Series' values are first
              aligned; see ``.align()`` method). If an ndarray is passed, the
              values are used as-is determine the groups. A label or list of
              labels may be passed to group by the columns in ``self``. Notice
              that a tuple is interpreted a (single) key.
          axis : {0 or 'index', 1 or 'columns'}, default 0
              Split along rows (0) or columns (1).
          level : int, level name, or sequence of such, default None
              If the axis is a MultiIndex (hierarchical), group by a particular
              level or levels.
          as_index : bool, default True
              For aggregated output, return object with group labels as the
              index. Only relevant for DataFrame input. as_index=False is
              effectively "SQL-style" grouped output.
          sort : bool, default True
              Sort group keys. Get better performance by turning this off.
              Note this does not influence the order of observations within each
              group. Groupby preserves the order of rows within each group.
          group_keys : bool, default True
              When calling apply, add group keys to index to identify pieces.
          squeeze : bool, default False
              Reduce the dimensionality of the return type if possible,
              otherwise return a consistent type.
          observed : bool, default False
              This only applies if any of the groupers are Categoricals.
              If True: only show observed values for categorical groupers.
              If False: show all values for categorical groupers.
  
              .. versionadded:: 0.23.0
  
          **kwargs
              Optional, only accepts keyword argument 'mutated' and is passed
              to groupby.
  
          Returns
          -------
          DataFrameGroupBy or SeriesGroupBy
              Depends on the calling object and returns groupby object that
              contains information about the groups.
  
          See Also
          --------
          resample : Convenience method for frequency conversion and resampling
              of time series.
  
          Notes
          -----
          See the `user guide
          <http://pandas.pydata.org/pandas-docs/stable/groupby.html>`_ for more.
  
          Examples
          --------
          >>> df = pd.DataFrame({'Animal': ['Falcon', 'Falcon',
          ...                               'Parrot', 'Parrot'],
          ...                    'Max Speed': [380., 370., 24., 26.]})
          >>> df
             Animal  Max Speed
          0  Falcon      380.0
          1  Falcon      370.0
          2  Parrot       24.0
          3  Parrot       26.0
          >>> df.groupby(['Animal']).mean()
                  Max Speed
          Animal
          Falcon      375.0
          Parrot       25.0
  
          **Hierarchical Indexes**
  
          We can groupby different levels of a hierarchical index
          using the `level` parameter:
  
          >>> arrays = [['Falcon', 'Falcon', 'Parrot', 'Parrot'],
          ...           ['Captive', 'Wild', 'Captive', 'Wild']]
          >>> index = pd.MultiIndex.from_arrays(arrays, names=('Animal', 'Type'))
          >>> df = pd.DataFrame({'Max Speed': [390., 350., 30., 20.]},
          ...                   index=index)
          >>> df
                          Max Speed
          Animal Type
          Falcon Captive      390.0
                 Wild         350.0
          Parrot Captive       30.0
                 Wild          20.0
          >>> df.groupby(level=0).mean()
                  Max Speed
          Animal
          Falcon      370.0
          Parrot       25.0
          >>> df.groupby(level=1).mean()
                   Max Speed
          Type
          Captive      210.0
          Wild         185.0
          """
          from pandas.core.groupby.groupby import groupby
  
          if level is None and by is None:
              raise TypeError("You have to supply one of 'by' and 'level'")
          axis = self._get_axis_number(axis)
          return groupby(self, by=by, axis=axis, level=level, as_index=as_index,
                         sort=sort, group_keys=group_keys, squeeze=squeeze,
                         observed=observed, **kwargs)