docstr: Creates a TermDocMatrix from a pandas data frame.
  
  Parameters
  ----------
  data_frame : pd.DataFrame
      The data frame that contains columns for the category of interest
      and the document text.
  text_col : str
      The name of the column which contains each document's raw text.
  category_col : str
      The name of the column which contains the category of interest.
  clean_function : function, optional
      A function that strips invalid characters out of the document text string,
      returning the new string.
  nlp : function, optional
  feats_from_spacy_doc : FeatsFromSpacyDoc or None
  verbose : boolean, optional
      If true, prints a message every time a document index % 100 is 0.
  
  See Also
  --------
  TermDocMatrixFactory
docstr_tok: ["Creates","a","TermDocMatrix","from","a","pandas","data","frame",".","Parameters","--","--","--","--","--","data_frame",":","pd.DataFrame","The","data","frame","that","contains","columns","for","the","category","of","interest","and","the","document","text",".","text_col",":","str","The","name","of","the","column","which","contains","each","document","'s","raw","text",".","category_col",":","str","The","name","of","the","column","which","contains","the","category","of","interest",".","clean_function",":","function",",","optional","A","function","that","strips","invalid","characters","out","of","the","document","text","string",",","returning","the","new","string",".","nlp",":","function",",","optional","feats_from_spacy_doc",":","FeatsFromSpacyDoc","or","None","verbose",":","boolean",",","optional","If","true",",","prints","a","message","every","time","a","document","index","%","100","is","0",".","See","Also","--","--","--","--","TermDocMatrixFactory"]
code: def __init__(
      self,
      data_frame,
      category_col,
      text_col,
      clean_function=lambda x: x,
      nlp=None,
      feats_from_spacy_doc=None,
      verbose=False,
  ):
      """Creates a TermDocMatrix from a pandas data frame.
  
      Parameters
      ----------
      data_frame : pd.DataFrame
          The data frame that contains columns for the category of interest
          and the document text.
      text_col : str
          The name of the column which contains each document's raw text.
      category_col : str
          The name of the column which contains the category of interest.
      clean_function : function, optional
          A function that strips invalid characters out of the document text string,
          returning the new string.
      nlp : function, optional
      feats_from_spacy_doc : FeatsFromSpacyDoc or None
      verbose : boolean, optional
          If true, prints a message every time a document index % 100 is 0.
  
      See Also
      --------
      TermDocMatrixFactory
      """
      TermDocMatrixFactory.__init__(
          self,
          clean_function=clean_function,
          nlp=nlp,
          feats_from_spacy_doc=feats_from_spacy_doc,
      )
      self.data_frame = data_frame.reset_index()
      self._text_col = text_col
      self._category_col = category_col
      self._verbose = verbose
  
imports: import numpy
  import pandas
  from scattertext.AsianNLP import chinese_nlp
  from scattertext.CSRMatrixTools import CSRMatrixFactory
  from scattertext.TermDocMatrix import TermDocMatrix
  from scattertext.TermDocMatrixFactory import TermDocMatrixFactory
  from scattertext.TermDocMatrixWithoutCategories import TermDocMatrixWithoutCategories
  from scattertext.indexstore.IndexStore import IndexStore
label_desc: Use image node_id 1 to create a new TermDocMatrixFromPandas object from inherited base classes: TermDocMatrixFactory with example: obj = TermDocMatrixFromPandas(data_frame, category_col, text_col, clean_function, nlp, feats_from_spacy_doc, verbose)