def insert_column(self, name, data, colnum=None):
if name in self._colnames:<EOL><INDENT>raise ValueError("<STR_LIT>" % name)<EOL><DEDENT>if IS_PY3 and data.dtype.char == '<STR_LIT>':<EOL><INDENT>descr = numpy.empty(<NUM_LIT:1>).astype(data.dtype).astype('<STR_LIT:S>').dtype.descr<EOL><DEDENT>else:<EOL><INDENT>descr = data.dtype.descr<EOL><DEDENT>if len(descr) > <NUM_LIT:1>:<EOL><INDENT>raise ValueError("<STR_LIT>"<EOL>"<STR_LIT>" % descr)<EOL><DEDENT>this_descr = descr[<NUM_LIT:0>]<EOL>this_descr = [name, this_descr[<NUM_LIT:1>]]<EOL>if len(data.shape) > <NUM_LIT:1>:<EOL><INDENT>this_descr += [data.shape[<NUM_LIT:1>:]]<EOL><DEDENT>this_descr = tuple(this_descr)<EOL>name, fmt, dims = _npy2fits(<EOL>this_descr,<EOL>table_type=self._table_type_str)<EOL>if dims is not None:<EOL><INDENT>dims = [dims]<EOL><DEDENT>if colnum is None:<EOL><INDENT>new_colnum = len(self._info['<STR_LIT>']) + <NUM_LIT:1><EOL><DEDENT>else:<EOL><INDENT>new_colnum = colnum+<NUM_LIT:1><EOL><DEDENT>self._FITS.insert_col(self._ext+<NUM_LIT:1>, new_colnum, name, fmt, tdim=dims)<EOL>self._update_info()<EOL>self.write_column(name, data)<EOL>
Insert a new column.

parameters
----------
name: string
    The column name
data:
    The data to write into the new column.
colnum: int, optional
    The column number for the new column, zero-offset.  Default
    is to add the new column after the existing ones.

Notes
-----
This method is used un-modified by ascii tables as well.