I have around 50 columns and the rows of the columns are duplicated with similar values. For exmample as:
Idx Series Col1 Col2 Col3 Col4 Col5 ..... Col50
0 A 1
1 A 1
2 A 1
3 A 1
4 B 3 2 3
5 B 3 2 3
6 B 3 2 3
7 B 3 2 3
8 C 4 1
9 C 4 1
10 C 4 1
11 C 4 1
I want to keep one value from the repeated values according to its position and change others to '0'
So if the value is '4' then the value at 4th position is kept and first three are changed to '0'. Similarly if the value is '1' then the first one is kept and remaining are changed to '0'.
The output columns will be:
Idx Series Col1 Col2 Col3 Col4 Col5 ..... Col50
0 A 1
1 A 0
2 A 0
3 A 0
4 B 0 0 0
5 B 0 2 0
6 B 3 0 3
7 B 0 0 0
8 C 0 1
9 C 0 0
10 C 0 0
11 C 4 0
Any help will is appreciated.
Thank you..