code: def _get_num_terms_at_rank(self, rank_i, rank_df):
      return sum(
          np.isnan(rank_df[rank_df <= rank_i]).apply(
              lambda x: not all(x), axis=1
          )
      )
  
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 AssociationCompactor obj's underlying member method code with example usage: obj._get_num_terms_at_rank(rank_i, rank_df) and returns: sum