def create_table_hdu(self, data=None, dtype=None,<EOL>header=None,<EOL>names=None, formats=None,<EOL>units=None, dims=None, extname=None, extver=None,<EOL>table_type='<STR_LIT>', write_bitcols=False):
<EOL>self.keys['<STR_LIT>'] = write_bitcols<EOL>table_type_int = _extract_table_type(table_type)<EOL>if data is not None:<EOL><INDENT>if isinstance(data, numpy.ndarray):<EOL><INDENT>names, formats, dims = array2tabledef(<EOL>data, table_type=table_type, write_bitcols=write_bitcols)<EOL><DEDENT>elif isinstance(data, (list, dict)):<EOL><INDENT>names, formats, dims = collection2tabledef(<EOL>data, names=names, table_type=table_type,<EOL>write_bitcols=write_bitcols)<EOL><DEDENT>else:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>")<EOL><DEDENT><DEDENT>elif dtype is not None:<EOL><INDENT>dtype = numpy.dtype(dtype)<EOL>names, formats, dims = descr2tabledef(<EOL>dtype.<EOL>descr,<EOL>write_bitcols=write_bitcols,<EOL>table_type=table_type,<EOL>)<EOL><DEDENT>else:<EOL><INDENT>if names is None or formats is None:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>")<EOL><DEDENT>if not isinstance(names, list) or not isinstance(formats, list):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if len(names) != len(formats):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if dims is not None:<EOL><INDENT>if not isinstance(dims, list):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if len(dims) != len(names):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT><DEDENT><DEDENT>if units is not None:<EOL><INDENT>if not isinstance(units, list):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if len(units) != len(names):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT><DEDENT>if extname is None:<EOL><INDENT>extname = "<STR_LIT>"<EOL><DEDENT>else:<EOL><INDENT>if not isstring(extname):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>extname = mks(extname)<EOL><DEDENT>if extname is not None and extver is not None:<EOL><INDENT>extver = check_extver(extver)<EOL><DEDENT>if extver is None:<EOL><INDENT>extver = <NUM_LIT:0><EOL><DEDENT>if extname is None:<EOL><INDENT>extname = "<STR_LIT>"<EOL><DEDENT>if header is not None:<EOL><INDENT>nkeys = len(header)<EOL><DEDENT>else:<EOL><INDENT>nkeys = <NUM_LIT:0><EOL><DEDENT>self._FITS.create_table_hdu(table_type_int, nkeys,<EOL>names, formats, tunit=units, tdim=dims,<EOL>extname=extname, extver=extver)<EOL>self.update_hdu_list(rebuild=False)<EOL>
Create a new, empty table extension and reload the hdu list.

There are three ways to do it:
    1) send a numpy dtype, from which the formats in the fits file will
       be determined.
    2) Send an array in data= keyword.  this is required if you have
        object fields for writing to variable length columns.
    3) send the names,formats and dims yourself

You can then write data into the new extension using
    fits[extension].write(array)
If you want to write to a single column
    fits[extension].write_column(array)
But be careful as the other columns will be left zeroed.

Often you will instead just use write_table to do this all
atomically.

    fits.write_table(recarray)

write_table will create the new table extension for you with the
appropriate fields.

parameters
----------
dtype: numpy dtype or descriptor, optional
    If you have an array with fields, you can just send arr.dtype.  You
    can also use a list of tuples, e.g. [('x','f8'),('index','i4')] or
    a dictionary representation.
data: a numpy array with fields, optional
      or a dictionary

    An array or dict from which to determine the table definition.  You
    must use this instead of sending a descriptor if you have object
    array fields, as this is the only way to determine the type and max
    size.

names: list of strings, optional
    The list of field names
formats: list of strings, optional
    The TFORM format strings for each field.
dims: list of strings, optional
    An optional list of dimension strings for each field.  Should
    match the repeat count for the formats fields. Be careful of
    the order since FITS is more like fortran. See the descr2tabledef
    function.

table_type: string, optional
    Either 'binary' or 'ascii', default 'binary'
    Matching is case-insensitive
units: list of strings, optional
    An optional list of unit strings for each field.
extname: string, optional
    An optional extension name.
extver: integer, optional
    FITS allows multiple extensions to have the same name (extname).
    These extensions can optionally specify an EXTVER version number in
    the header.  Send extver= to set a particular version, which will
    be represented in the header with keyname EXTVER.  The extver must
    be an integer > 0.  If extver is not sent, the first one will be
    selected.  If ext is an integer, the extver is ignored.
write_bitcols: bool, optional
    Write boolean arrays in the FITS bitcols format, default False

header: FITSHDR, list, dict, optional
    This is only used to determine how many slots to reserve for
    header keywords


restrictions
------------
The File must be opened READWRITE