nodes: 0, module; 1, function_definition; 2, function_name:get_zeroth_quarter_idx; 3, parameters; 4, block; 5, identifier:self; 6, identifier:stacked_last_per_qtr; 7, expression_statement; 8, expression_statement; 9, return_statement; 10, comment:"""
          Filters for releases that are on or after each simulation date and
          determines the previous quarter by picking out the most recent
          release relative to each date in the index.
  
          Parameters
          ----------
          stacked_last_per_qtr : pd.DataFrame
              A DataFrame with index of calendar dates, sid, and normalized
              quarters with each row being the latest estimate for the row's
              index values, sorted by event date.
  
          Returns
          -------
          previous_releases_per_date_index : pd.MultiIndex
              An index of calendar dates, sid, and normalized quarters, for only
              the rows that have a previous event.
          """; 11, assignment; 12, attribute; 13, identifier:previous_releases_per_date; 14, call; 15, identifier:previous_releases_per_date; 16, identifier:index; 17, attribute; 18, argument_list; 19, call; 20, identifier:nth; 21, unary_operator; 22, attribute; 23, argument_list; 24, integer:1; 25, subscript; 26, identifier:groupby; 27, keyword_argument; 28, keyword_argument; 29, comment:# Here we take advantage of the fact that `stacked_last_per_qtr` is; 30, comment:# sorted by event date.; 31, attribute; 32, comparison_operator:stacked_last_per_qtr[EVENT_DATE_FIELD_NAME] <=
              stacked_last_per_qtr.index.get_level_values(SIMULATION_DATES); 33, identifier:level; 34, list; 35, identifier:as_index; 36, False; 37, identifier:stacked_last_per_qtr; 38, identifier:loc; 39, subscript; 40, call; 41, identifier:SIMULATION_DATES; 42, identifier:SID_FIELD_NAME; 43, identifier:stacked_last_per_qtr; 44, identifier:EVENT_DATE_FIELD_NAME; 45, attribute; 46, argument_list; 47, attribute; 48, identifier:get_level_values; 49, identifier:SIMULATION_DATES; 50, identifier:stacked_last_per_qtr; 51, identifier:index
code: def get_zeroth_quarter_idx(self, stacked_last_per_qtr):
          """
          Filters for releases that are on or after each simulation date and
          determines the previous quarter by picking out the most recent
          release relative to each date in the index.
  
          Parameters
          ----------
          stacked_last_per_qtr : pd.DataFrame
              A DataFrame with index of calendar dates, sid, and normalized
              quarters with each row being the latest estimate for the row's
              index values, sorted by event date.
  
          Returns
          -------
          previous_releases_per_date_index : pd.MultiIndex
              An index of calendar dates, sid, and normalized quarters, for only
              the rows that have a previous event.
          """
          previous_releases_per_date = stacked_last_per_qtr.loc[
              stacked_last_per_qtr[EVENT_DATE_FIELD_NAME] <=
              stacked_last_per_qtr.index.get_level_values(SIMULATION_DATES)
          ].groupby(
              level=[SIMULATION_DATES, SID_FIELD_NAME],
              as_index=False,
              # Here we take advantage of the fact that `stacked_last_per_qtr` is
              # sorted by event date.
          ).nth(-1)
          return previous_releases_per_date.index