Suppose I have a dataframe:
C1 V1 C2 V2 Cond
1 2 3 4 X
5 6 7 8 Y
9 10 11 12 X
The statements should return: if Cond == X, pick C1 and v1, else pick C2 and V2
.
The output dataframe is something like:
C V
1 2
7 8
9 10
** EDIT: To add one more requirement: the number of columns can change but follow some naming pattern. In this case select all columns with "1" in it, else with "2". I think the hard-coded solution might not work.