pandas offers the ability to look up by lists of row and column indices,
In [49]: index = ['a', 'b', 'c', 'd']
In [50]: columns = ['one', 'two', 'three', 'four']
In [51]: M = pandas.DataFrame(np.random.randn(4,4), index=index, columns=columns)
In [52]: M
Out[52]: 
        one       two     three      four
a -0.785841 -0.538572  0.376594  1.316647
b  0.530288 -0.975547  1.063946 -1.049940
c -0.794447 -0.886721  1.794326 -0.714834
d -0.158371  0.069357 -1.003039 -0.807431
In [53]: M.lookup(index, columns) # diagonal entries
Out[53]: array([-0.78584142, -0.97554698,  1.79432641, -0.8074308 ])
I would like to use this same method of indexing to set M's elements.  How can I do this?
 
     
     
     
    