Given three lists x,y,z
of identical size à la
x = [1, 0,.2,.2, 1, 0]
y = [0, 0, 0, 1,.2,.2]
z = [0, 2, 3, 1, 0, 1]
with unique but incomplete pairings of x,y
float values, how to map z
to a matrix Z[i,j]
where i,j
correspond to the indices np.unique
of x,y
respectively? In the example this would be something like
Z = [[ 2, 0, 3],
['', '', 1],
[ 1, 0, '']]
where ''
might as well be np.nan
. This does somehow sound like an inverse np.meshgrid
, and I could hack up my own implementation, but is there no pre-existing solution?
I tried the suggestions here, but they assume a complete grid. Another solution sounds nice but interpolates the missing points, which is not what I want.