title: How to insert NaN array into a numpy 2D array
body: <p>I'm trying to insert an arbitrary number of rows of NaN values within a 2D array at specific places. I'm logging some data from a microcontroller in a .csv file and parsing with python.</p>
  
  <p>The data is stored in a 3 column 2D array like this</p>
  
  <pre><code>[(122.0, 1.0, -47.0) (123.0, 1.0, -47.0) (125.0, 1.0, -44.0) ..., 
  (39.0, 1.0, -47.0) (40.0, 1.0, -45.0) (41.0, 1.0, -47.0)]
  </code></pre>
  
  <p>The first column is an sequence counter. What I'm trying to do is iterate through the sequence values, diff current and previous sequence number  and insert as many rows with nan as there are missing sequences.</p>
  
  <p>Basically, </p>
  
  <pre><code>[(122.0, 1.0, -47.0) (123.0, 1.0, -47.0) (125.0, 1.0, -44.0)]
  </code></pre>
  
  <p>would become</p>
  
  <pre><code>[(122.0, 1.0, -47.0) (123.0, 1.0, -47.0) (nan, nan, nan) (125.0, 1.0, -44.0)]
  </code></pre>
  
  <p>However the following implementation of <code>np.insert</code> produces an error</p>
  
  <pre><code>while (i &lt; len(list[1])):
       pid = list[i][0]
       newMissing = (pid - LastGoodId + 255) % 256
       TotalMissing = TotalMissing + newMissing
       np.insert(list,i,np.zeros(newMissing,1) + np.nan)   
       i = i + newMissing
       list[i][0] = TotalMissing
       LastGoodId = pid 
  </code></pre>
  
  <blockquote>
    <p>---> 28                 np.insert(list,i,np.zeros(newMissing,1) + np.nan)
         29                 i = i + newMissing
         30                 list[i][0] = TotalMissing</p>
    
    <p>TypeError: data type not understood</p>
  </blockquote>
  
  <p>Any ideas on how I can accomplish this?</p>