Ejemplo n.º 1
0
def mark_confirmed(df):
    df2 = df.copy()

    for col in common.category_columns(df2):
        for (colval, g) in df2[df2[common.STATUS] == common.UNSURE].groupby(col):
            if g.shape[0] == 1:
                # there is only 1 remaining row for this value
                df2.loc[g.index[0], common.STATUS] = common.CONFIRMED

    return df2
Ejemplo n.º 2
0
def is_only_remaining_pair(df):
    """ Here we check for any pair of cat:val-s that are the only non rejected
        combination. If we find any such pair, we update our df

    """
    df2 = df.copy()
    for col in common.category_columns(df2):
        othercols = [c for c in common.category_columns(df2) if c != col]
        for (colval, g) in df2[common.is_possible(df2)].groupby(col):
            for othercol in othercols:
                oval0 = g[othercol].iloc[0]
                if (g[othercol] == oval0).all():
                    # there is only one value of othercal for col
                    df2 = is_same(
                        common.catval_filter(col, colval),
                        common.catval_filter(othercol, oval0),
                        df2
                    )

    return df2