def clean_column_name(df, index, name):
    """Check that the column has the expected name (case insensitive)
    as a sanity check that the user provided the right data, 
    and return a new dataframe with the column renamed to the preferred casing.
    """
    df_name = str(df.columns[index])

    if df_name.lower() != name:
        raise ValueError('Column {} in the dataframe must be called "{}"'.format(index + 1, name))

    return df.rename(columns={ df_name: name })