def melt(df):
    """Melt a census dataframe into two value columns, for the estimate and margin"""
    import pandas as pd
    melted = pd.melt(df, id_vars=list(df.columns[:9]), value_vars=list(df.
        columns[9:]))
    melted = melted[['gvid', 'variable', 'value']]
    estimates = melted[~melted.variable.str.contains('_m90')].set_index([
        'gvid', 'variable'])
    margins = melted[melted.variable.str.contains('_m90')].copy()
    margins.columns = ['gvid', 'ovariable', 'm90']
    margins['variable'] = margins.ovariable.str.replace('_m90', '')
    final = estimates.join(margins.set_index(['gvid', 'variable']).drop(
        'ovariable', 1))
    return final
