import pandas as pd

def load_population(path):
    df = pd.read_csv(path, sep=";")

    df["cod_mun_ibge_6"] = df["cod_mun_ibge_6"].astype(str)

    return df


def merge_population(df_sih, df_pop):
    df_sih["cod_mun_ibge_6"] = df_sih["cod_mun_ibge_6"].astype(str)

    df = df_sih.merge(
        df_pop[["cod_mun_ibge_6", "municipio", "populacao", "ano"]],
        on=["cod_mun_ibge_6", "ano"],
        how="left"
    )

    return df
