title: Rolling median for a large dataset - python
body: <p>I have a huge file with 200K lines, I need to find out the rolling median by counting distinct words in each line.</p>
  
  <p>I have used numpy to calculate median as below</p>
  
  <pre><code>   a = np.array([])
     np.insert(a, 0, len(unique_word_list_by_line))
     median = np.median(a)
  </code></pre>
  
  <p>I feel that this is not efficient as numpy creates a new array everytime i insert an element. Is there a way to insert an element into a numpy array inplace?</p>
  
  <p>Thanks</p>