def add_missing_columns(df_in, required_columns, fill_val=0.0):
    """Adds columns to the DataFrame 'df_in' if it does not contain all of the
    columns in the list 'required_columns'.  'fill_val' is the value that is used
    to fill the new columns.
    """
    missing_cols = set(required_columns) - set(df_in.columns)
    for col in missing_cols:
        df_in[col] = fill_val

    return df_in