def get_cols(db, cols):

    def get_col(col):
        data = db.execute('SELECT ' + col + ' FROM data', dtype=np.float64)
return np.fromiter(v[0] for v in data)
return np.vstack([get_col(col) for col in cols]).T
How do you create a multidimensional numpy array from an iterable of tuples?