Currently, I'm loading in some data into memory of the form:
5.579158e-19 0 0
5.678307e-19 1 0
...
6.041513e-19 27 0
5.938317e-19 28 0
...
5.978803e-19 38 1
5.590008e-19 39 1
5.588807e-19 0 2
5.670948e-19 1 2
...
and so on with the command:
import numpy as np
data_res = np.genfromtxt('/path/data.csv',delimiter=';', dtype = float)
What I want, is a 40x40 matrix mat, where the indices are the entries in the second and third columns. The first entry mat[0,0] = data[0,0] is easy, but the problem is that the list is not sorted and that the entries in the second an third columns are floats so I can't reference them in the slice.
I've tried a double for loop method but it does not work properly.
mat = np.zeros((40,40))
for k in range(0,40):
for j in range(0,40):
mat[k,j] = data_res[k*j,0]
Wouldn't this method work if the index ran from 1-40 and not 0-39?
Thanks.