code: def _term_rank_score_and_frequency_df(
      self, all_categories, category, other_categories, scores
  ):
      df = self._add_x_and_y_coords_to_term_df_if_injected(
          self._get_term_category_frequencies()
      )
  
      if scores is None:
          scores = self._get_default_scores(
              category, other_categories, df
          )
      # np.array(self.term_doc_matrix.get_rudder_scores(category))
      # convention_df['category score'] = np.array(self.term_doc_matrix.get_rudder_scores(category))
      category_column_name = str(category) + " freq"
      df = df["category score"] = CornerScore.get_scores_for_category(
          df[str(category_column_name)],
          df[[str(c) + " freq" for c in other_categories]].sum(axis=1),
      )
      if self.scatterchartdata.term_significance is not None:
          df = df.assign(
              p=get_p_vals(
                  df,
                  category_column_name,
                  self.scatterchartdata.term_significance,
              )
          )
  
      df["not category score"] = CornerScore.get_scores_for_category(
          df[[str(c) + " freq" for c in other_categories]].sum(axis=1),
          df[str(category_column_name)],
      )
      df["color_scores", :] = scores
      if (
          self.scatterchartdata.terms_to_include is None
          and self.scatterchartdata.dont_filter is False
      ):
          df = self._filter_bigrams_by_minimum_not_category_term_freq(
              category_column_name, other_categories, df
          )
          df = filter_bigrams_by_pmis(
              self._filter_by_minimum_term_frequency(
                  all_categories, df
              ),
              threshold_coef=self.scatterchartdata.pmi_threshold_coefficient,
          )
  
      if self.scatterchartdata.filter_unigrams:
          df = filter_out_unigrams_that_only_occur_in_one_bigram(df)
      if len(df) == 0:
          raise NoWordMeetsTermFrequencyRequirementsError()
      df["category score rank"] = rankdata(
          df["category score"], method="ordinal"
      )
      df["not category score rank"] = rankdata(
          df["not category score"], method="ordinal"
      )
      if (
          self.scatterchartdata.max_terms
          and self.scatterchartdata.max_terms < len(df)
      ):
          assert self.scatterchartdata.max_terms > 0
          df = self._limit_max_terms(category, df)
      df = df.reset_index()
      return df
  
imports: import logging
  import sys
  import numpy
  import pandas
  from scipy.stats import rankdata
  from scattertext.PValGetter import get_p_vals
  from scattertext.Scalers import percentile_min, percentile_alphabetical
  from scattertext.ScatterChartData import ScatterChartData
  from scattertext.TermDocMatrixFilter import filter_bigrams_by_pmis, filter_out_unigrams_that_only_occur_in_one_bigram
  from scattertext.termscoring import ScaledFScore
  from scattertext.termscoring.RankDifference import RankDifference
  from scattertext.termscoring.CornerScore import CornerScore
label_desc: Use image node_id 18 for calling the ScatterChart obj's underlying member method code with example usage: obj._term_rank_score_and_frequency_df(all_categories, category, other_categories, scores) and returns: df