def create_axes(self, axes, obj, validate=True, nan_rep=None,<EOL>data_columns=None, min_itemsize=None, **kwargs):
<EOL>if axes is None:<EOL><INDENT>try:<EOL><INDENT>axes = _AXES_MAP[type(obj)]<EOL><DEDENT>except KeyError:<EOL><INDENT>raise TypeError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>".format(<EOL>group=self.group._v_name, value=type(obj)))<EOL><DEDENT><DEDENT>axes = [obj._get_axis_number(a) for a in axes]<EOL>if self.infer_axes():<EOL><INDENT>existing_table = self.copy()<EOL>existing_table.infer_axes()<EOL>axes = [a.axis for a in existing_table.index_axes]<EOL>data_columns = existing_table.data_columns<EOL>nan_rep = existing_table.nan_rep<EOL>self.encoding = existing_table.encoding<EOL>self.errors = existing_table.errors<EOL>self.info = copy.copy(existing_table.info)<EOL><DEDENT>else:<EOL><INDENT>existing_table = None<EOL><DEDENT>if len(axes) != self.ndim - <NUM_LIT:1>:<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>")<EOL><DEDENT>self.non_index_axes = []<EOL>self.data_columns = []<EOL>if nan_rep is None:<EOL><INDENT>nan_rep = '<STR_LIT>'<EOL><DEDENT>self.nan_rep = nan_rep<EOL>index_axes_map = dict()<EOL>for i, a in enumerate(obj.axes):<EOL><INDENT>if i in axes:<EOL><INDENT>name = obj._AXIS_NAMES[i]<EOL>index_axes_map[i] = _convert_index(<EOL>a, self.encoding, self.errors, self.format_type<EOL>).set_name(name).set_axis(i)<EOL><DEDENT>else:<EOL><INDENT>append_axis = list(a)<EOL>if existing_table is not None:<EOL><INDENT>indexer = len(self.non_index_axes)<EOL>exist_axis = existing_table.non_index_axes[indexer][<NUM_LIT:1>]<EOL>if not array_equivalent(np.array(append_axis),<EOL>np.array(exist_axis)):<EOL><INDENT>if array_equivalent(np.array(sorted(append_axis)),<EOL>np.array(sorted(exist_axis))):<EOL><INDENT>append_axis = exist_axis<EOL><DEDENT><DEDENT><DEDENT>info = _get_info(self.info, i)<EOL>info['<STR_LIT>'] = list(a.names)<EOL>info['<STR_LIT:type>'] = a.__class__.__name__<EOL>self.non_index_axes.append((i, append_axis))<EOL><DEDENT><DEDENT>self.index_axes = [<EOL>index_axes_map[a].set_pos(j).update_info(self.info)<EOL>for j, a in enumerate(axes)<EOL>]<EOL>j = len(self.index_axes)<EOL>for a in self.axes:<EOL><INDENT>a.maybe_set_size(min_itemsize=min_itemsize)<EOL><DEDENT>for a in self.non_index_axes:<EOL><INDENT>obj = _reindex_axis(obj, a[<NUM_LIT:0>], a[<NUM_LIT:1>])<EOL><DEDENT>def get_blk_items(mgr, blocks):<EOL><INDENT>return [mgr.items.take(blk.mgr_locs) for blk in blocks]<EOL><DEDENT>block_obj = self.get_object(obj)._consolidate()<EOL>blocks = block_obj._data.blocks<EOL>blk_items = get_blk_items(block_obj._data, blocks)<EOL>if len(self.non_index_axes):<EOL><INDENT>axis, axis_labels = self.non_index_axes[<NUM_LIT:0>]<EOL>data_columns = self.validate_data_columns(<EOL>data_columns, min_itemsize)<EOL>if len(data_columns):<EOL><INDENT>mgr = block_obj.reindex(<EOL>Index(axis_labels).difference(Index(data_columns)),<EOL>axis=axis<EOL>)._data<EOL>blocks = list(mgr.blocks)<EOL>blk_items = get_blk_items(mgr, blocks)<EOL>for c in data_columns:<EOL><INDENT>mgr = block_obj.reindex([c], axis=axis)._data<EOL>blocks.extend(mgr.blocks)<EOL>blk_items.extend(get_blk_items(mgr, mgr.blocks))<EOL><DEDENT><DEDENT><DEDENT>if existing_table is not None:<EOL><INDENT>by_items = {tuple(b_items.tolist()): (b, b_items)<EOL>for b, b_items in zip(blocks, blk_items)}<EOL>new_blocks = []<EOL>new_blk_items = []<EOL>for ea in existing_table.values_axes:<EOL><INDENT>items = tuple(ea.values)<EOL>try:<EOL><INDENT>b, b_items = by_items.pop(items)<EOL>new_blocks.append(b)<EOL>new_blk_items.append(b_items)<EOL><DEDENT>except (IndexError, KeyError):<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>".format(<EOL>items=('<STR_LIT:U+002C>'.join(pprint_thing(item) for<EOL>item in items))))<EOL><DEDENT><DEDENT>blocks = new_blocks<EOL>blk_items = new_blk_items<EOL><DEDENT>self.values_axes = []<EOL>for i, (b, b_items) in enumerate(zip(blocks, blk_items)):<EOL><INDENT>klass = DataCol<EOL>name = None<EOL>if (data_columns and len(b_items) == <NUM_LIT:1> and<EOL>b_items[<NUM_LIT:0>] in data_columns):<EOL><INDENT>klass = DataIndexableCol<EOL>name = b_items[<NUM_LIT:0>]<EOL>self.data_columns.append(name)<EOL><DEDENT>if existing_table is not None and validate:<EOL><INDENT>try:<EOL><INDENT>existing_col = existing_table.values_axes[i]<EOL><DEDENT>except (IndexError, KeyError):<EOL><INDENT>raise ValueError(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>".format(<EOL>blocks=blocks,<EOL>table=existing_table.values_axes))<EOL><DEDENT><DEDENT>else:<EOL><INDENT>existing_col = None<EOL><DEDENT>try:<EOL><INDENT>col = klass.create_for_block(<EOL>i=i, name=name, version=self.version)<EOL>col.set_atom(block=b, block_items=b_items,<EOL>existing_col=existing_col,<EOL>min_itemsize=min_itemsize,<EOL>nan_rep=nan_rep,<EOL>encoding=self.encoding,<EOL>errors=self.errors,<EOL>info=self.info)<EOL>col.set_pos(j)<EOL>self.values_axes.append(col)<EOL><DEDENT>except (NotImplementedError, ValueError, TypeError) as e:<EOL><INDENT>raise e<EOL><DEDENT>except Exception as detail:<EOL><INDENT>raise Exception(<EOL>"<STR_LIT>"<EOL>"<STR_LIT>".format(<EOL>name=b.dtype.name, items=b_items, detail=detail))<EOL><DEDENT>j += <NUM_LIT:1><EOL><DEDENT>self.validate_min_itemsize(min_itemsize)<EOL>self.validate_metadata(existing_table)<EOL>if validate:<EOL><INDENT>self.validate(existing_table)<EOL><DEDENT>
create and return the axes
        leagcy tables create an indexable column, indexable index,
        non-indexable fields

            Parameters:
            -----------
            axes: a list of the axes in order to create (names or numbers of
                the axes)
            obj : the object to create axes on
            validate: validate the obj against an existing object already
                written
            min_itemsize: a dict of the min size for a column in bytes
            nan_rep : a values to use for string column nan_rep
            encoding : the encoding for string values
            data_columns : a list of columns that we want to create separate to
                allow indexing (or True will force all columns)