class_docstr: Produce a simple ASCII, CSV, HTML, or LaTeX table from a
  *rectangular* (2d!) array of data, not necessarily numerical.
  Directly supports at most one header row,
  which should be the length of data[0].
  Directly supports at most one stubs column,
  which must be the length of data.
  (But see `insert_stubs` method.)
  See globals `default_txt_fmt`, `default_csv_fmt`, `default_html_fmt`,
  and `default_latex_fmt` for formatting options.
  
  Sample uses::
  
      mydata = [[11,12],[21,22]]  # data MUST be 2-dimensional
      myheaders = [ "Column 1", "Column 2" ]
      mystubs = [ "Row 1", "Row 2" ]
      tbl = text.SimpleTable(mydata, myheaders, mystubs, title="Title")
      print( tbl )
      print( tbl.as_html() )
      # set column specific data formatting
      tbl = text.SimpleTable(mydata, myheaders, mystubs,
          data_fmts=["%3.2f","%d"])
      print( tbl.as_csv() )
      with open('c:/temp/temp.tex','w') as fh:
          fh.write( tbl.as_latex_tabular() )
class_docstr_tok: ["Produce","a","simple","ASCII",",","CSV",",","HTML",",","or","LaTeX","table","from","a","*","rectangular","*","(","2d","!",")","array","of","data",",","not","necessarily","numerical",".","Directly","supports","at","most","one","header","row",",","which","should","be","the","length","of","data","[","0","]",".","Directly","supports","at","most","one","stubs","column",",","which","must","be","the","length","of","data",".","(","But","see","`","insert_stubs","`","method",".",")","See","globals","`","default_txt_fmt","`",",","`","default_csv_fmt","`",",","`","default_html_fmt","`",",","and","`","default_latex_fmt","`","for","formatting","options",".","Sample","uses",":",":","mydata","=","[","[","11,12","]",",","[","21,22","]","]","#","data","MUST","be","2-dimensional","myheaders","=","[","``","Column","1","''",",","``","Column","2","''","]","mystubs","=","[","``","Row","1","''",",","``","Row","2","''","]","tbl","=","text.SimpleTable","(","mydata",",","myheaders",",","mystubs",",","title=","''","Title","''",")","print","(","tbl",")","print","(","tbl.as_html","(",")",")","#","set","column","specific","data","formatting","tbl","=","text.SimpleTable","(","mydata",",","myheaders",",","mystubs",",","data_fmts=","[","``","%","3.2f","''",",","''","%","d","''","]",")","print","(","tbl.as_csv","(",")",")","with","open","(","'","c",":","\/temp\/temp.tex","'",",","'","w","'",")","as","fh",":","fh.write","(","tbl.as_latex_tabular","(",")",")"]
docstr: Return None.  Insert column of stubs at column `loc`.
  If there is a header row, it gets an empty cell.
  So ``len(stubs)`` should equal the number of non-header rows.
docstr_tok: ["Return","None",".","Insert","column","of","stubs","at","column","`","loc","`",".","If","there","is","a","header","row",",","it","gets","an","empty","cell",".","So","``","len","(","stubs",")","``","should","equal","the","number","of","non-header","rows","."]
code: def insert_stubs(self, loc, stubs):
      """Return None.  Insert column of stubs at column `loc`.
      If there is a header row, it gets an empty cell.
      So ``len(stubs)`` should equal the number of non-header rows.
      """
      _Cell = self._Cell
      stubs = iter(stubs)
      for row in self:
          if row.datatype == "header":
              empty_cell = _Cell("", datatype="empty")
              row.insert(loc, empty_cell)
          else:
              try:
                  row.insert_stub(loc, next(stubs))
              except StopIteration:
                  raise ValueError(
                      "length of stubs must match table length"
                  )
  
imports: from statsmodels.compat.python import lmap, lrange
  from itertools import cycle, zip_longest
  import csv
label_desc: Use image node_id 9 for calling the SimpleTable obj's underlying member method code with example usage: obj.insert_stubs(loc, stubs) without return types