def compute_referendum_result_by_regions(referendum_and_areas):
    """Return a table with the absolute count for each region.

    The return DataFrame should be indexed by `code_reg` and have columns:
    ['name_reg', 'Registered', 'Abstentions', 'Null', 'Choice A', 'Choice B']

    Parameters
    ----------
    referendum_and_areas: pandas.DataFrame
        contains information about referendums in different departments

    Returns
    -------
    df : pandas.DataFrame
        dataframe grouped by region

    """
    df = referendum_and_areas.groupby(["name_reg"]).sum()
    df["name_reg"] = list(df.index)
    df.index = list(range(df.shape[0]))
    cols = ['name_reg',
            'Registered',
            'Abstentions',
            'Null',
            'Choice A',
            'Choice B']

    return df[cols]