I have dataframe df_pattern containing pattern(rules):
df_pattern = pd.DataFrame({'SiteId': [4, 5, 6, 7, 8],
'ZoneId': [1, 1, 1, 2, 2]})
That pattern must be followed by another dataframe:
df_checked = pd.DataFrame({'SiteId': [6, 5, 7, 4, 8, 7, 5, 8, 6],
'ZoneId': [1, 1, 2, 2, 2, 2, 1, 1, 1]})
SiteId values 4,5,6 must be only associated with value 1 (ZoneId) and 7,8 with value 2.
I'd love to find rows which doesnt follow this pattern. Therefore result should like this:
index SitedId ZoneId
3 4 2
7 8 1
Thank you.
question from:
https://stackoverflow.com/questions/66059658/check-whether-combination-of-values-from-multiple-dataframes-columns-follow-giv 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…