class_docstr: Options:
      - "majority": the majority value of the rankings
      - "max": the max value of the rankings
      - "min": the min value of the rankings
docstr: The function `_aggregate` takes a list of `FeedbackRecord` objects and a question, and
  aggregates the responses for that question based on a specified aggregation method.
  
  Args:
  - records The `records` parameter is a list of `FeedbackRecord` objects. Each
  `FeedbackRecord` object represents a feedback record and contains information about the
  responses given for a particular feedback.
  - question The `question` parameter in the `_aggregate` method is a string that represents
  the question for which the responses are being aggregated.
  
  Returns:
  the updated list of FeedbackRecord objects after aggregating the responses for the
  specified question.
docstr_tok: ["The","function","`","_aggregate","`","takes","a","list","of","`","FeedbackRecord","`","objects","and","a","question",",","and","aggregates","the","responses","for","that","question","based","on","a","specified","aggregation","method",".","Args",":","-","records","The","`","records","`","parameter","is","a","list","of","`","FeedbackRecord","`","objects",".","Each","`","FeedbackRecord","`","object","represents","a","feedback","record","and","contains","information","about","the","responses","given","for","a","particular","feedback",".","-","question","The","`","question","`","parameter","in","the","`","_aggregate","`","method","is","a","string","that","represents","the","question","for","which","the","responses","are","being","aggregated",".","Returns",":","the","updated","list","of","FeedbackRecord","objects","after","aggregating","the","responses","for","the","specified","question","."]
code: def _aggregate(self, records: List[FeedbackRecord], question: str):
      """
      The function `_aggregate` takes a list of `FeedbackRecord` objects and a question, and
      aggregates the responses for that question based on a specified aggregation method.
  
      Args:
      - records The `records` parameter is a list of `FeedbackRecord` objects. Each
      `FeedbackRecord` object represents a feedback record and contains information about the
      responses given for a particular feedback.
      - question The `question` parameter in the `_aggregate` method is a string that represents
      the question for which the responses are being aggregated.
  
      Returns:
      the updated list of FeedbackRecord objects after aggregating the responses for the
      specified question.
      """
      if self.value == self.MEAN.value:
          return self._mean(records, question)
  
      for rec in records:
          if not rec.responses:
              continue
          # only allow for submitted responses
          responses = [
              resp
              for resp in rec.responses
              if resp.status == "submitted"
          ]
          # get responses with a value that is most frequent
          total_values = []
          total_ranks = []
          for resp in responses:
              if question in resp.values:
                  values = []
                  ranks = []
                  for value in resp.values[question].value:
                      values.append(value.value)
                      ranks.append(value.rank)
  
                  total_values.append(tuple(values))
                  total_ranks.append(tuple(ranks))
  
          if not total_values:
              continue
          df = pd.DataFrame(
              {"value": total_values, "rank": total_ranks}
          )
  
          # unified response
          if self.value == self.MAX.value:
              df = df[df["rank"] == df["rank"].max()]
          elif self.value == self.MIN.value:
              df = df[df["rank"] == df["rank"].min()]
          else:
              raise ValueError("Invalid aggregation method")
  
          if len(df) > 0:
              # Extract the first of the possible values (in case there is more than one).
              unified_rank = [
                  {"rank": item[1], "value": item[0]}
                  for item in zip(*df.iloc[0].to_list())
              ]
              rec._unified_responses[question] = [
                  UnifiedValueSchema(
                      value=unified_rank, strategy=self.value
                  )
              ]
  
      return records
  
imports: import random
  from abc import abstractmethod
  from collections import Counter
  from enum import Enum
  from typing import Any, Dict, List, Union
  import pandas
  from argilla.client.feedback.schemas import FeedbackRecord, LabelQuestion, MultiLabelQuestion, RankingQuestion, RatingQuestion, ValueSchema
  from argilla.pydantic_v1 import BaseModel, root_validator, validator
label_desc: Use image node_id 2 for calling the RankingQuestionStrategy obj's underlying member method code with example usage: obj._aggregate(records, question) and returns: records, self