I have a dataframe (df)
| x1 | y1 | value1 | x2 | y2 | value2 |
|---|---|---|---|---|---|
| 1 | 150 | blue | 1 | 150 | blue |
| 2 | 151 | red | 2 | 151 | green |
| 3 | 152 | green | 3 | 152 | green |
| 4 | 153 | yellow | 4 | 153 | blue |
| 5 | 154 | orange | 5 | 154 | yellow |
| 6 | 155 | blue | 6 | 155 | green |
| 7 | 156 | blue | 7 | 156 | blue |
The x and y rows are always equal in the each other but value1 and value2 may differ. I want to create a new dataframe of instances where value1 != value2. As such:
| x1 | y1 | value1 | x2 | y2 | value2 |
|---|---|---|---|---|---|
| 2 | 151 | red | 2 | 151 | green |
| 4 | 153 | yellow | 4 | 153 | blue |
| 5 | 154 | orange | 5 | 154 | yellow |
| 6 | 155 | blue | 6 | 155 | green |
I have tried result_df = df.drop_duplicates(['value1', 'value2'], keep=False) but that does not seem to drop all duplicates