I have a file containing 3 columns, where the first two are coordinates (x,y) and the third is a value (z) corresponding to that position. Here\'s a short example:
You could try something like:
import numpy as np x = [0, 0, 1, 1, 2, 2] y = [1, 2, 0, 1, 1, 2] z = [14, 17, 15, 16, 18, 13] arr = np.zeros((3,3)) yx = zip(y,x) for i, coord in enumerate(yx): arr[coord] = z[i] print arr >>> [[ 0. 15. 0.] [ 14. 16. 18.] [ 17. 0. 13.]]