'Initialize table from an ndarray structured array'

def _init_from_ndarray(self, data, names, dtype, n_cols, copy):

    data_names = (data.dtype.names or _auto_names(n_cols))
    struct = (data.dtype.names is not None)
    names = [(name or data_names[i]) for (i, name) in enumerate(names)]
    cols = ([data[name] for name in data_names] if struct else [data[:, i] for i in range(n_cols)])
    self._set_masked_from_cols(cols)
    if copy:
        self._init_from_list(cols, names, dtype, n_cols, copy)
    else:
        dtype = [(name, col.dtype, col.shape[1:]) for (name, col) in zip(names, cols)]
        newdata = data.view(dtype).ravel()
        columns = self.TableColumns()
        for name in names:
            columns[name] = self.ColumnClass(name=name, data=newdata[name])
            columns[name].info.parent_table = self
        self.columns = columns
