def extract_pob(loaded_df):
    """
    Extracts the place of birth of each row. The coded values are the following:
    -1 - Invalid value
    1 - Born inside Canada
    2 - Born outside Canada
    :param loaded_df: The dataframe loaded from the file
    :return: A list containing the new values of the place of birth
    """
    pobs = []
    columns = loaded_df.columns
    col_name = ""

    print('Extracting Place of Birth')

    if "POBP" in columns:
        col_name = "POBP"
    elif "POB" in columns:
        col_name = "POB"
    else:
        print("No Place of Birth Column(s) Detected")

    num_uniq = loaded_df[col_name].nunique()

    for pob in loaded_df[col_name].tolist():
        if col_name == "POBP":
            if num_uniq == 41:
                if pob <= 10 or (pob >= 33 and pob <= 35):  # Inside Canada
                    pobs.append(1)
                elif pob <= 40:  # Outside Canada
                    pobs.append(2)
                else:  # invalid value
                    pobs.append(-1)
            elif num_uniq == 13:
                if pob < 6:  # Inside Canada
                    pobs.append(1)
                elif pob <= 12:  # Outside Canada
                    pobs.append(2)
                else:  # invalid value
                    pobs.append(-1)
        else:
            if num_uniq == 28:
                if pob == 1:  # Inside Canada
                    pobs.append(1)
                elif pob <= 27:  # Outside Canada
                    pobs.append(2)
                else:  # invalid value
                    pobs.append(-1)
            elif num_uniq == 33:
                if pob == 1:  # Inside Canada
                    pobs.append(1)
                elif pob <= 32:  # Outside Canada
                    pobs.append(2)
                else:  # invalid value
                    pobs.append(-1)

    print('Place of Birth extracted')

    return pobs