def make_household_choices(hh_util):
    # convert hh_util dict to a few DFs with alternatives in the columns
    # and household IDs in the index
    df_func = tz.compose(
        pd.DataFrame.transpose,
        pd.DataFrame.from_dict)
    grouped_by_size = (
        tz.valfilter(lambda x: len(x) == l, hh_util)
        for l in tz.unique(tz.map(len, hh_util.values())))
    dfs = tz.map(df_func, grouped_by_size)

    # go over all the DFs and do utils_to_probs and make_choices
    choices = (
        pd.Series(
            df.columns[mnl.make_choices(mnl.utils_to_probs(df))].values,
            index=df.index)
        for df in dfs)

    # concat all the resulting Series
    return pd.concat(choices)
Setup the application
dataset/ETHPy150Open UDST/activitysim/activitysim/cdap/cdap.py/make_household_choices--crossover with--dataset/ETHPy150Open rsms/smisk/examples/core/key-value-store/app.py/KeyValueStore.__init__