The following commands show how to attribute to a slice:
In [81]: a=pd.DataFrame([[1,2,3],[4,5,6],[7,8,9]])
In [82]: a
Out[82]:
0 1 2
0 1 2 3
1 4 5 6
2 7 8 9
In [83]: a.loc[1] = [10,11,12]
In [84]: a
Out[84]:
0 1 2
0 1 2 3
1 10 11 12
2 7 8 9
However, what I need to attribute to a sliced which is pointed by a variable. I tried
In [91]: row2 = a.loc[2]
In [92]: row2 = [13,14,15]
In [93]: a
Out[93]:
0 1 2
0 1 2 3
1 10 11 12
2 7 8 9
In [94]: row2
Out[94]: [13, 14, 15]
At this point, I wanted the value of "a" to be
In [96]: a
Out[96]:
0 1 2
0 1 2 3
1 10 11 12
2 13 14 15
It's obvious that row2 is being treated as a copy of the slice, not the slice itself.
So, my question is: how do I create variable the points to the slice, and that can be use to attribute values to the elements of the original matrix?