def calc_variables(df, var_list):
    """Calculate area-weighted values for variables. 
    Formula: x_pre=A_intersect1 / A_pre * x_bg1 +  A_intersect2 / A_pre * x_bg2
    Args: 
        df (DataFrame): the dataframe containing census spatially merged with precincts
        var_list (list): names of variables to calculate. 
    Returns: 
        DataFrame: contains area-weighted values for variables. 
    """
    
    for var in var_list: 
        df[var+'_wgt'] = df[var]*df.intersect_area/ df.area_m
    df['prop_area'] = df.intersect_area/ df.area_m  # include proportional area as a check. 
    return(df)