Esempio n. 1
0
def run():
    args = base_parser().parse_args()
    for sw in EXTRA_STOPS:
        nlp.vocab[sw].is_stop = True
    main(args)
Esempio n. 2
0
def main():
    args = base_parser().parse_args()
    run(args)
Esempio n. 3
0
              & (df["Islander"] != "Charlie Frederick")]


def recode_cols(args, df):
    df["islander"] = df["Islander"].apply(lambda x: x.split(" ")[0].lower())
    df["arrived"] = df["Entered"].apply(lambda x: x.split(" ")[1])
    df["dumped"] = df["Status"].apply(lambda x: x.split("Day ")[1].replace(
        ")", "") if x != "Participating" else 59)
    df["age"] = df["Age"]
    df["arrived"] = df["arrived"].astype(int)
    df["dumped"] = df["dumped"].astype(int)
    df["season"] = args.season
    return df[["islander", "arrived", "dumped", "age"]]


def to_dict(df):
    df = df.set_index("islander")
    print(df.to_dict(orient="index"))


def main(args):
    df = get_df(args)
    df = filter_dupe(df)
    df = recode_cols(args, df)
    to_dict(df)


if __name__ in "__main__":
    args = base_parser().parse_args()
    main(args)