Break a list into ``columns`` number of columns.
16309
def partition(list_, columns=2):
    

    iter_ = iter(list_)
    columns = int(columns)
    rows = []

    while True:
        row = []
        for column_number in range(1, columns + 1):
            try:
                value = six.next(iter_)
            except StopIteration:
                pass
            else:
                row.append(value)

        if not row:
            return rows
        rows.append(row)
1107124
def rows_to_columns(matrix):
#hammer
    """"""
    num_rows = len(matrix)
    num_cols = len(matrix[0])

    data = []
    for i in range(0, num_cols):
        data.append([matrix[j][i] for j in range(0, num_rows)])

    return data
735094
def pad_chunk_columns(chunk):
    """"""
    columns = set()
    for record in chunk:
        columns.update(record.keys())
    for record in chunk:
        for column in columns:
            record.setdefault(column, None)
    return chunk
325144
def get_columns_rows(filenames):
    """"""
    tiles = []
    for filename in filenames:
        row, column = os.path.splitext(filename)[0][-5:].split('_')
        tiles.append((int(row), int(column)))
    rows = [pos[0] for pos in tiles]; columns = [pos[1] for pos in tiles]
    num_rows = max(rows); num_columns = max(columns)
    return (num_columns, num_rows)
40750
def print_split(column_to_split, total_columns):
    """"""
    out = ""
    for _ in range(column_to_split):
        out += "| "
    out += "|\\"
    for _ in range(column_to_split + 1, total_columns):
        out += " \\"
    print(out)
397186
def cols_str(columns):
    """"""
    cols = ""
    for c in columns:
        cols = cols + wrap(c) + ', '
    return cols[:-2]
357624
def spaced_items(list_, n, **kwargs):
    
    indexes = spaced_indexes(len(list_), n, **kwargs)
    items = list_[indexes]
    return items
77803
def columnOf(self, index):
        
        columns = self.columns()
        if ( 0 <= index and index < len(columns) ):
            return columns[index]
        return ''
878860
def from_column_wise_lists(self, lol, header_rows=0, transpose=False, names=None):
        
        #super(Columns, self).__init__()
        self.clear()
        self.len_column = None

        if transpose:
            return self.from_row_wise_lists(lol, header_rows, transpose=False, names=None)
        names = names or [j for j, column in enumerate(lol)]
        for i, col in enumerate(lol):
            self[names[i]] = [value for value in col]
        self.len_column = min(len(self[i]) for i in self)
        return self
446387
def _pys2col_widths(self, line):
        """"""

        # Split with maxsplit 3
        split_line = self._split_tidy(line)
        key = col, tab = self._get_key(*split_line[:2])
        width = float(split_line[2])

        shape = self.code_array.shape

        try:
            if col < shape[1] and tab < shape[2]:
                self.code_array.col_widths[key] = width

        except ValueError:
            pass
293093
def chunk_list(l, n):
    """"""
    return [l[i:i + n] for i in range(0, len(l), n)]
1346542
def from_array(cls, arr):
        """"""
        return cls().with_columns([(f, arr[f]) for f in arr.dtype.names])
268170
def normalize_column_names(df):
    
    """
    columns = df.columns if hasattr(df, 'columns') else df
    columns = [c.lower().replace(' ', '_') for c in columns]
    return columns
337225
def drop_columns(records, slices):
    
    for record in records:
        # Generate a set of indices to remove
        drop = set(i for slice in slices
                   for i in range(*slice.indices(len(record))))
        keep = [i not in drop for i in range(len(record))]
        record.seq = Seq(''.join(itertools.compress(record.seq, keep)), record.seq.alphabet)
        yield record
214538
def _format_list(self, data):
        
        dataset = "["
        i = 0
        for el in data:
            if pd.isnull(el):
                dataset += "null"
            else:
                dtype = type(data[i])
                if dtype == int or dtype == float:
                    dataset += str(el)
                else:
                    dataset += '"' + el + '"'
            if i < len(data) - 1:
                dataset += ', '
        dataset += "]"
        return dataset
117095
def column_stack_2d(data):
    """"""
    return list(list(itt.chain.from_iterable(_)) for _ in zip(*data))
624920
def cut(list_, index=0):
    """"""
    if isinstance(index, int):
        cut_ = lambda x: x[index]
    else:
        cut_ = lambda x: getattr(x, index)
    return list(map(cut_, list_))