Given a triangular matrix m
in python how best to extract from it the value at row i
column j
?
m = [1,np.nan,np.nan,2,3,np.nan,4,5,6]
m = pd.DataFrame(np.array(x).reshape((3,3)))
Which looks like:
0 1 2
0 1.0 NaN NaN
1 2.0 3.0 NaN
2 4.0 5.0 6.0
I can get lower elements easily m[2,0]
returns 4
.
But if I ask for m[0,2]
i get nan
when I would like 4
again.
What is the best way of accomplishing this with in python?