コード例 #1
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
コード例 #2
0
 def poss(self):
     return self.df[common.is_possible(self.df)]