nodes: 0, module; 1, function_definition; 2, function_name:sorted_groupby; 3, parameters; 4, block; 5, identifier:df; 6, identifier:groupby; 7, expression_statement; 8, expression_statement; 9, expression_statement; 10, for_statement; 11, comment:# need to send back the last group; 12, expression_statement; 13, comment:"""
      Perform a groupby on a DataFrame using a specific column
      and assuming that that column is sorted.
  
      Parameters
      ----------
      df : pandas.DataFrame
      groupby : object
          Column name on which to groupby. This column must be sorted.
  
      Returns
      -------
      generator
          Yields pairs of group_name, DataFrame.
  
      """; 14, assignment; 15, assignment; 16, pattern_list; 17, call; 18, block; 19, yield; 20, identifier:start; 21, integer:0; 22, identifier:prev; 23, subscript; 24, identifier:i; 25, identifier:x; 26, identifier:enumerate; 27, argument_list; 28, if_statement; 29, expression_list; 30, attribute; 31, identifier:start; 32, subscript; 33, comparison_operator:x != prev; 34, block; 35, identifier:prev; 36, subscript; 37, subscript; 38, identifier:iloc; 39, identifier:df; 40, identifier:groupby; 41, identifier:x; 42, identifier:prev; 43, expression_statement; 44, expression_statement; 45, expression_statement; 46, attribute; 47, slice; 48, identifier:df; 49, identifier:groupby; 50, yield; 51, assignment; 52, assignment; 53, identifier:df; 54, identifier:iloc; 55, identifier:start; 56, expression_list; 57, identifier:prev; 58, identifier:x; 59, identifier:start; 60, identifier:i; 61, identifier:prev; 62, subscript; 63, attribute; 64, slice; 65, identifier:df; 66, identifier:iloc; 67, identifier:start; 68, identifier:i
code: def sorted_groupby(df, groupby):
      """
      Perform a groupby on a DataFrame using a specific column
      and assuming that that column is sorted.
  
      Parameters
      ----------
      df : pandas.DataFrame
      groupby : object
          Column name on which to groupby. This column must be sorted.
  
      Returns
      -------
      generator
          Yields pairs of group_name, DataFrame.
  
      """
      start = 0
      prev = df[groupby].iloc[start]
      for i, x in enumerate(df[groupby]):
          if x != prev:
              yield prev, df.iloc[start:i]
              prev = x
              start = i
      # need to send back the last group
      yield prev, df.iloc[start:]