def create_table(<EOL>data,<EOL>meta=None,<EOL>fields=None,<EOL>skip_header=True,<EOL>import_fields=None,<EOL>samples=None,<EOL>force_types=None,<EOL>max_rows=None,<EOL>*args,<EOL>**kwargs<EOL>):
table_rows = iter(data)<EOL>force_types = force_types or {}<EOL>if import_fields is not None:<EOL><INDENT>import_fields = make_header(import_fields)<EOL><DEDENT>if fields is None:  <EOL><INDENT>header = make_header(next(table_rows))<EOL>if samples is not None:<EOL><INDENT>sample_rows = list(islice(table_rows, <NUM_LIT:0>, samples))<EOL>table_rows = chain(sample_rows, table_rows)<EOL><DEDENT>else:<EOL><INDENT>if max_rows is not None and max_rows > <NUM_LIT:0>:<EOL><INDENT>sample_rows = table_rows = list(islice(table_rows, max_rows))<EOL><DEDENT>else:<EOL><INDENT>sample_rows = table_rows = list(table_rows)<EOL><DEDENT><DEDENT>detected_fields = detect_types(<EOL>header,<EOL>sample_rows,<EOL>skip_indexes=[<EOL>index<EOL>for index, field in enumerate(header)<EOL>if field in force_types or field not in (import_fields or header)<EOL>],<EOL>*args,<EOL>**kwargs<EOL>)<EOL>new_fields = [<EOL>field_name<EOL>for field_name in detected_fields.keys()<EOL>if field_name not in header<EOL>]<EOL>fields = OrderedDict(<EOL>[<EOL>(field_name, detected_fields.get(field_name, TextField))<EOL>for field_name in header + new_fields<EOL>]<EOL>)<EOL>fields.update(force_types)<EOL>header = list(fields.keys())<EOL>if import_fields is None:<EOL><INDENT>import_fields = header<EOL><DEDENT><DEDENT>else:  <EOL><INDENT>if not isinstance(fields, OrderedDict):<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>if skip_header:<EOL><INDENT>next(table_rows)<EOL><DEDENT>header = make_header(list(fields.keys()))<EOL>if import_fields is None:<EOL><INDENT>import_fields = header<EOL><DEDENT>fields = OrderedDict(<EOL>[(field_name, fields[key]) for field_name, key in zip(header, fields)]<EOL>)<EOL><DEDENT>diff = set(import_fields) - set(header)<EOL>if diff:<EOL><INDENT>field_names = "<STR_LIT:U+002CU+0020>".join('<STR_LIT>'.format(field) for field in diff)<EOL>raise ValueError("<STR_LIT>".format(field_names))<EOL><DEDENT>fields = OrderedDict(<EOL>[(field_name, fields[field_name]) for field_name in import_fields]<EOL>)<EOL>get_row = get_items(*map(header.index, import_fields))<EOL>table = Table(fields=fields, meta=meta)<EOL>if max_rows is not None and max_rows > <NUM_LIT:0>:<EOL><INDENT>table_rows = islice(table_rows, max_rows)<EOL><DEDENT>table.extend(dict(zip(import_fields, get_row(row))) for row in table_rows)<EOL>source = table.meta.get("<STR_LIT:source>", None)<EOL>if source is not None:<EOL><INDENT>if source.should_close:<EOL><INDENT>source.fobj.close()<EOL><DEDENT>if source.should_delete and Path(source.uri).exists():<EOL><INDENT>unlink(source.uri)<EOL><DEDENT><DEDENT>return table<EOL>
Create a rows.Table object based on data rows and some configurations

    - `skip_header` is only used if `fields` is set
    - `samples` is only used if `fields` is `None`. If samples=None, all data
      is filled in memory - use with caution.
    - `force_types` is only used if `fields` is `None`
    - `import_fields` can be used either if `fields` is set or not, the
      resulting fields will seek its order
    - `fields` must always be in the same order as the data