def to_category(df, colname, vals):
    """Convert column to categoricals with specified values
    
    Parameters
    ----------
    * df : dataframe
    * colname : str, name of column
    * vals : CategoricalDtype
    
    Returns
    ----------
    * dataframe
    """
    df[colname] = df[colname].astype(vals).astype('category')
    return df