class_docstr: Used to render a DataFrame to a LaTeX tabular/longtable environment
  output.
  
  Parameters
  ----------
  formatter : `DataFrameFormatter`
  column_format : str, default None
      The columns format as specified in `LaTeX table format
      <https://en.wikibooks.org/wiki/LaTeX/Tables>`__ e.g 'rcl' for 3 columns
  longtable : boolean, default False
      Use a longtable environment instead of tabular.
  
  See Also
  --------
  HTMLFormatter
class_docstr_tok: ["Used","to","render","a","DataFrame","to","a","LaTeX","tabular\/longtable","environment","output",".","Parameters","--","--","--","--","--","formatter",":","`","DataFrameFormatter","`","column_format",":","str",",","default","None","The","columns","format","as","specified","in","`","LaTeX","table","format","<","https",":","\/\/en.wikibooks.org\/wiki\/LaTeX\/Tables",">","`","__","e.g","'rcl","'","for","3","columns","longtable",":","boolean",",","default","False","Use","a","longtable","environment","instead","of","tabular",".","See","Also","--","--","--","--","HTMLFormatter"]
docstr: Combine columns belonging to a group to a single multicolumn entry
  according to self.multicolumn_format
  
  e.g.:
  a &  &  & b & c &
  will become
  \multicolumn{3}{l}{a} & b & \multicolumn{2}{l}{c}
docstr_tok: ["Combine","columns","belonging","to","a","group","to","a","single","multicolumn","entry","according","to","self.multicolumn_format","e.g",".",":","a","&","&","&","b","&","c","&","will","become","\\multicolumn","{","3","}","{","l","}","{","a","}","&","b","&","\\multicolumn","{","2","}","{","l","}","{","c","}"]
code: def _format_multicolumn(self, row, ilevels):
      r"""
      Combine columns belonging to a group to a single multicolumn entry
      according to self.multicolumn_format
  
      e.g.:
      a &  &  & b & c &
      will become
      \multicolumn{3}{l}{a} & b & \multicolumn{2}{l}{c}
      """
      row2 = list(row[:ilevels])
      ncol = 1
      coltext = ""
  
      def append_col():
          # write multicolumn if needed
          if ncol > 1:
              row2.append(
                  "\\multicolumn{{{ncol:d}}}{{{fmt:s}}}{{{txt:s}}}".format(
                      ncol=ncol,
                      fmt=self.multicolumn_format,
                      txt=coltext.strip(),
                  )
              )
          # don't modify where not needed
          else:
              row2.append(coltext)
  
      for c in row[ilevels:]:
          # if next col has text, write the previous
          if c.strip():
              if coltext:
                  append_col()
              coltext = c
              ncol = 1
          # if not, add it to the previous multicolumn
          else:
              ncol += 1
      # write last column name
      if coltext:
          append_col()
      return row2
  
file_path: catboost/contrib/python/pandas/py2/pandas/io/formats/latex.py
imports: from __future__ import print_function
  import numpy
  from pandas.compat import map, range, u, zip
  from pandas.core.dtypes.generic import ABCMultiIndex
  from pandas import compat
  from pandas.io.formats.format import TableFormatter
label_desc: Use image node_id 3 for calling the LatexFormatter obj's underlying member method code with example usage: obj._format_multicolumn(row, ilevels) and returns: row2