def preprocess_demographic_data(pop, drop_cols, pivot_idx, pivot_col,
    aggfunc='sum'):
    """
    Standard preprocessing procedure if pop data follows the format of
    experimental datasets:
    Drop the unwanted columns, then create a spreadsheet-style pivot table
    as a DataFrame by dropping the MultiIndex objects on the columns.

    Parameters
    ----------
    pop : DataFrame
        demographic dataset.
    drop_cols : str or list of strs
        columns to drop/delete.
    pivot_idx/pivot_col : str, column, Grouper, array or list of the previous
        index/column to aggregate.
    aggfunc : function, list of functions, dict, default numpy.mean
        function to aggregate on

    Returns
    -------
    pop : DataFrame
        Proprocessed demographic Dataset in an excel style pivot table without
        MultiIndex.

    """
    pop.drop(labels=drop_cols, axis=1, inplace=True)
    pop = pop.pivot_table(index=pivot_idx, columns=pivot_col, aggfunc=aggfunc)
    pop.columns = pop.columns.droplevel()
    return pop