docstr: json_df['cat25k'] = (((term_freq_df[category + ' freq'] * 1.
                         / term_freq_df[category + ' freq'].sum()) * 25000).fillna(0)
                       .apply(np.round).astype(int))
  json_df['ncat25k'] = (((term_freq_df['not cat freq'] * 1.
                          / term_freq_df['not cat freq'].sum()) * 25000).fillna(0)
                        .apply(np.round).astype(int))
docstr_tok: ["json_df","[","'cat25k","'","]","=","(","(","(","term_freq_df","[","category","+","'","freq","'","]","*","1",".","\/","term_freq_df","[","category","+","'","freq","'","]",".sum","(",")",")","*","25000",")",".fillna","(","0",")",".apply","(","np.round",")",".astype","(","int",")",")","json_df","[","'ncat25k","'","]","=","(","(","(","term_freq_df","[","'not","cat","freq","'","]","*","1",".","\/","term_freq_df","[","'not","cat","freq","'","]",".sum","(",")",")","*","25000",")",".fillna","(","0",")",".apply","(","np.round",")",".astype","(","int",")",")"]
code: def _add_term_freq_to_json_df(
      self, json_df, term_freq_df, category
  ) -> pd.DataFrame:
      """
      json_df['cat25k'] = (((term_freq_df[category + ' freq'] * 1.
                             / term_freq_df[category + ' freq'].sum()) * 25000).fillna(0)
                           .apply(np.round).astype(int))
      json_df['ncat25k'] = (((term_freq_df['not cat freq'] * 1.
                              / term_freq_df['not cat freq'].sum()) * 25000).fillna(0)
                            .apply(np.round).astype(int))
      """
      json_df = json_df.assign(
          cat25k=(
              (
                  (
                      term_freq_df[str(category) + " freq"]
                      * 1.0
                      / term_freq_df[str(category) + " freq"].sum()
                  )
                  * 25000
              )
              .fillna(0)
              .apply(np.round)
              .astype(int)
          ),
          ncat25k=(
              (
                  (
                      term_freq_df["not cat freq"]
                      * 1.0
                      / term_freq_df["not cat freq"].sum()
                  )
                  * 25000
              )
              .fillna(0)
              .apply(np.round)
              .astype(int)
          ),
          neut25k=0,
          neut=0,
          extra25k=0,
          extra=0,
      )
  
      if "neut cat freq" in term_freq_df:
          json_df = json_df.assign(
              neut25k=(
                  (
                      (
                          term_freq_df["neut cat freq"]
                          * 1.0
                          / term_freq_df["neut cat freq"].sum()
                      )
                      * 25000
                  )
                  .fillna(0)
                  .apply(np.round)
                  .astype(int)
              ),
              neut=term_freq_df["neut cat freq"],
          )
  
      if "extra cat freq" in term_freq_df:
          json_df = json_df.assign(
              extra25k=(
                  (
                      (
                          term_freq_df["extra cat freq"]
                          * 1.0
                          / term_freq_df["extra cat freq"].sum()
                      )
                      * 25000
                  )
                  .fillna(0)
                  .apply(np.round)
                  .astype(int)
              ),
              extra=term_freq_df["extra cat freq"],
          )
      return json_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 14 for calling the ScatterChart obj's underlying member method code with example usage: obj._add_term_freq_to_json_df(json_df, term_freq_df, category) and returns: json_df