I have a dataframe that has this shape:
| col A | col B | col i | col j | col .. | col z |
|---|---|---|---|---|---|
| 1 | 2 | B | A | A | A |
| 2 | 3 | B | A | B | B |
The first two columns have the values I want to populate with the rest of the columns. The rest of the colums (col i...col z) should be populated with values from col A and col B depending on the value of each one. For example, the first row of col i has a B, so it should be populated with the value of col B at the same row (2).
I tried different functions for this, apply, applymap, but none of them are suitable for this use case.
The remaining table in this example should look like this:
| col A | col B | col i | col j | col .. | col z |
|---|---|---|---|---|---|
| 1 | 2 | 2 | 1 | 1 | 1 |
| 2 | 3 | 3 | 2 | 3 | 3 |