0

Given 2 columns in a pandas dataframe, I want to check that if a value of a pair in one column is x in the second column, then the matching value in the pair is y in the second column. Example data below:

col1 col2
A    x
A    y
B    y
B    x
C    y
C    y

For example, if the first A is x, then the other A should be y. So for this dataset, the pairs AA and BB satisfy the criterion. But CC does not because both C's have y's.

I'm new to coding, so any help would be appreciated! Thanks in advance.

psychcoder
  • 543
  • 3
  • 14

0 Answers0