I have the following data frame in spark
s s_type o o_type
-----------------
s1 ss1 o1 oo1
s2 ss2 o2 oo2
I want to swap the columns
s s_type o o_type
-----------------
o1 oo1 s1 ss1
o2 oo2 s2 ss2
one way is to copy columns [o, o_type] into temporary columns ['o_temp','o_type_temp']
and then copy the values of [s,s_type] into [o,o_type] and finally ['o_temp','o_type_temp'] into [s,s_type].
I was wondering if there is a better/more efficient way to do this?