I am trying to swap the rows of two python tables, e.g
In [15]: print t2
x y z
---- ---- ----
20.0 30.0 40.0
50.0 60.0 70.0
80.0 90.0 99.0
In [16]: print t1
a b c
--- --- ---
1.0 2.0 3.0
3.0 4.0 5.0
6.0 7.0 8.0
I want it to be
In [15]: print t2
x y z
---- ---- ----
20.0 30.0 40.0
3.0 4.0 5.0
80.0 90.0 99.0
In [16]: print t1
a b c
--- --- ---
1.0 2.0 3.0
50.0 60.0 70.0
6.0 7.0 8.0
I tried using the examples given here Is there a standardized method to swap two variables in Python?, but none of them are working probably because of the row type:
In [19]: type(t1[1])
Out[19]: astropy.table.row.Row
e.g.
In [20]: t1[1],t2[1] = t2[1], t1[1]
In [21]: print t1
a b c
---- ---- ----
1.0 2.0 3.0
50.0 60.0 70.0
6.0 7.0 8.0
In [22]: print t2
x y z
---- ---- ----
20.0 30.0 40.0
50.0 60.0 70.0
80.0 90.0 99.0
i.e. t2 does not change. Is there a fix to it? I also tried using the first solution given in Python Simple Swap Function where I changed the row to a list and swapped them but it gives the assertion error. Can someone help please?