def assign_demographic_proportions(population_data):
    """Calculates conditional probabilities on the provided population data for use in sampling.

    Parameters
    ----------
    population_data : pandas.DataFrame
        Table with columns 'age', 'sex', 'year', 'location', and 'population'

    Returns
    -------
    pandas.DataFrame
        Table with the same columns as `population_data` and additionally with columns
        'P(sex, location, age| year)', 'P(sex, location | age, year)', and
        'P(age | year, sex, location)' with values calculated from the
        various population levels.
    """

    population_data['P(sex, location, age| year)'] = (
        population_data
            .groupby('year_start', as_index=False)
            .apply(lambda sub_pop: sub_pop.value / sub_pop.value.sum())
            .reset_index(level=0).value
    )

    population_data['P(sex, location | age, year)'] = (
        population_data
            .groupby(['age', 'year_start'], as_index=False)
            .apply(lambda sub_pop: sub_pop.value / sub_pop.value.sum())
            .reset_index(level=0).value
    )

    population_data['P(age | year, sex, location)'] = (
        population_data
            .groupby(['year_start', 'sex', 'location'], as_index=False)
            .apply(lambda sub_pop: sub_pop.value / sub_pop.value.sum())
            .reset_index(level=0).value
    )

    return population_data