Let's have the following 2 data tables. 1st one is collected data with errors and the second one contains correct possible pairs for x1 and x2:
1st one:
+----------+-----+------+
| x1 | x2 | x3 |
+----------+-----+------+
| march | 3 | 198 |
| april | 4 | 4984 |
| february | 2 | 498 |
| march | 35 | 984 |
| aripl | 4 | 498 |
+----------+-----+------+
2nd one:
+----------+----+
| x1 | x2 |
+----------+----+
| january | 1 |
| february | 2 |
| march | 3 |
| april | 4 |
| may | 5 |
+----------+----+
I want to find incorrect rows in the first table and correct them based on the second one. So the output should look like this:
+----------+----+------+
| x1 | x2 | x3 |
+----------+----+------+
| march | 3 | 198 |
| april | 4 | 4984 |
| february | 2 | 498 |
| march | 3 | 984 |
| april | 4 | 498 |
+----------+----+------+
It should check for the x1 if it is the correct name and then add the correct number or if x2 is the correct number then add the correct name.
For the first part, I guess the answer is here. Although I need to fit it for my situation somehow (so any help with it would be also appreciated). For the second part, all I know is using "for" and "if" which is not acceptable (or even not possible) for the speed issues.