def get_reference(condition_ref_string, stats_df):
    """
    If condition_ref_string matches a column in stats_df, return that
    column. If it doesn't match a column, try to convert it to a float.

    :param str condition_ref_string: left or right part of a condition             from a QC conditions file
    :param stats_df: QC statistics table
    :type stats_df: :class:`~pandas.DataFrame`
    :returns: Either a column of stats_df, a float or a string.
    """
    if condition_ref_string in stats_df.columns:
        return stats_df.loc[:, (condition_ref_string)]
    try:
        return float(condition_ref_string)
    except ValueError:
        return condition_ref_string
