I have a dataframe which looks something like this:
| index | c1 | c2 | c3 | m1 | m2 |
|---|---|---|---|---|---|
| 1 | a | b | c | a | c |
| 2 | d | e | f | d | a |
| 3 | a | b | c | d | e |
For each row the values in c1, c2, c3 will never be duplicates of each other, same with m1 & m2 My aim is for each row to only show each value once, i.e if a values in m1 or m2 already exists in c1, c2 or c3 it should be replaced with NaN.
So for the example I gave, the result would be:
| index | c1 | c2 | c3 | m1 | m2 |
|---|---|---|---|---|---|
| 1 | a | b | c | NaN | NaN |
| 2 | d | e | f | NaN | a |
| 3 | a | b | c | d | e |
How would this best be solved? Thanks