def _check_static_feat()

in fclib/fclib/dataset/ojdata.py [0:0]


def _check_static_feat(df, ts_id_col_names, static_feat_names):
    """Check if the input static features change over time and include ts_id_col_names.
    """
    for feat in static_feat_names:
        condition1 = (ts_id_col_names is None) and (df[feat].nunique() > 1)
        condition2 = (ts_id_col_names is not None) and (df.groupby(ts_id_col_names)[feat].nunique().max() > 1)
        if condition1 or condition2:
            raise ValueError("Input feature column {} is supposed to be static but it is not.".format(feat))