def select_field(X, cols=None, single_dimension=False):
    """ 
    Select columns from a pandas DataFrame

    Args:
        X (pandas DataFrame): input data
        cols (array-like): list of columns to select
        single_dimension (bool): reduce data to 
            one dimension if only one column
            is requested
    Returns:
        X (numpy array)
    """
    if cols is None:
        return X.values
    if len(cols) > 1:
        return X[cols].values
    if len(cols) == 1:
        if single_dimension:
            return X[cols[0]].values
        else:
            return X[cols].values