class_docstr: A collection of algorithms for construction of fair ranked candidate lists. [1]_ .
  
  References:
      .. [1] Sahin Cem Geyik, Stuart Ambler, and Krishnaram Kenthapadi,
          "Fairness-Aware Ranking in Search & Recommendation Systems with Application to LinkedIn Talent Search,"
          KDD '19: Proceedings of the 25th ACM SIGKDD International Conference
          on Knowledge Discovery & Data Mining, July 2019, Pages 2221-2231.
code: def fit(self, dataset: RegressionDataset):
      if (
          list(self.unprivileged_groups[0].keys())[0]
          != list(self.privileged_groups[0].keys())[0]
      ):
          raise ValueError(
              "Different sensitive attributes (not values) specified for unprivileged and privileged groups."
          )
  
      items = dataset.convert_to_dataframe()[0]
      items = items.sort_values(
          axis=0, by=dataset.label_names[0], ascending=False
      )
  
      if not (self.s.issubset(items.columns)):
          raise ValueError(
              f"The dataset must contain the protected attribute(s): '{self.s}'."
          )
  
      # if we have just 1 protected attribute
      if not isinstance(self.s, list) and False:
          self._item_groups = [
              items[items[self.s] == ai] for ai in self.s_vals
          ]
      else:
          self._item_groups = []
          for group in (
              self.unprivileged_groups + self.privileged_groups
          ):
              q = " & ".join(
                  [
                      f'{s_i}=="{v_i}"'
                      if isinstance(v_i, str)
                      else f"{s_i}=={v_i}"
                      for s_i, v_i in group.items()
                  ]
              )
              self._item_groups.append(items.query(q))
  
      # self._item_groups = {ai: it for ai, it in zip(
      #     self.s_vals, [items[items[self.s] == ai] for ai in self.s_vals])}
  
      return self
  
file_path: AIF360/aif360/algorithms/postprocessing/deterministic_reranking.py
imports: import numpy
  import pandas
  from aif360.algorithms import Transformer
  from aif360.datasets import StructuredDataset, RegressionDataset
label_desc: Use image node_id 2 for calling the DeterministicReranking obj's underlying member method code with example usage: obj.fit(dataset) and returns: self