interpolate missing values 2d python
<p>I have a 2d array(or matrix if you prefer) with some missing values represented as 
<code>NaN</code>. The missing values are typically in a strip along one axis, eg:</p>

<pre><code>1   2   3 NaN   5
2   3   4 Nan   6
3   4 Nan Nan   7
4   5 Nan Nan   8
5   6   7   8   9
</code></pre>

<p>where I would like to replace the <code>NaN</code>'s by somewhat sensible numbers. </p>

<p>I looked into delaunay triangulation, but found very little documentation. </p>

<p>I tried using <a href="http://docs.astropy.org/en/stable/convolution/index.html" rel="noreferrer"><code>astropy</code>'s convolve</a> as it supports use of 2d arrays, and is quite straightforward.
The problem with this is that convolution is not interpolation, it moves all values towards the average (which could be mitigated by using a narrow kernel).</p>

<p>This question should be the natural 2-dimensional extension to <a href="https://stackoverflow.com/questions/6518811/interpolate-nan-values-in-a-numpy-array">this post</a>. Is there a way to interpolate over <code>NaN</code>/missing values in a 2d-array? </p>