def extract_sectors(pred_df, thres):
    """Extracts labels for sectors above a threshold
    Args:
        pred_df (df): predicted sector
        thres (float): probability threshold
    """

    long_df = (
        pred_df.reset_index(drop=False)
        .melt(id_vars="index", var_name="division", value_name="probability")
        .query(f"probability > {thres}")
    )

    out = long_df.groupby("index")["division"].apply(lambda x: list(x))

    return out