code: def get_rank_df(self, term_doc_matrix) -> pd.DataFrame:
      tdf, tdf_sum = self.__get_term_ranks_and_frequencies(
          term_doc_matrix
      )
      score_data = {}
      categories = term_doc_matrix.get_categories()
      my_scorer = self._initialize_scorer(term_doc_matrix)
  
      if self.target_category is not None:
          assert self.target_category in categories
          if issubclass(self.scorer, CorpusBasedTermScorer):
              score_data[
                  str(self.target_category)
              ] = my_scorer.set_categories(
                  category_name=self.target_category
              ).get_scores()
              score_data["Not " + str(self.target_category)] = (
                  -1 * score_data[str(self.target_category)]
              )
          else:
              focus = tdf[str(self.target_category)].values
              background = tdf_sum.values - focus
              score_data[
                  str(self.target_category)
              ] = my_scorer.get_scores(focus, background)
              score_data[
                  "Not " + str(self.target_category)
              ] = my_scorer.get_scores(background, focus)
      else:
          for category in categories:
              if issubclass(self.scorer, CorpusBasedTermScorer):
                  score_data[str(category)] = my_scorer.set_categories(
                      category_name=category
                  ).get_scores()
              else:
                  focus = tdf[str(category)].values
                  background = tdf_sum.values - focus
                  score_data[str(category)] = my_scorer.get_scores(
                      focus, background
                  )
      return pd.DataFrame(score_data, index=tdf.index).apply(
          lambda x: rankdata(x, "dense")
      )
  
imports: from typing import Optional, Tuple
  import pandas
  import numpy
  from scattertext.termscoring.CorpusBasedTermScorer import CorpusBasedTermScorer
  from scipy.stats import rankdata
  from scattertext.termranking.AbsoluteFrequencyRanker import AbsoluteFrequencyRanker
  from scattertext.termscoring.ScaledFScore import ScaledFScorePresetsNeg1To1
label_desc: Use image node_id 3 for calling the TermCategoryRanker obj's underlying member method code with example usage: obj.get_rank_df(term_doc_matrix) and returns: pd