title: Removing nan from list - Python
body: <p>I am trying to remove 'nan' from a list, but it is refusing to go. I have tried both np.nan and 'nan'.</p>
  
  <p>This is my code:</p>
  
  <pre><code>ztt = []
  for i in z:
      if i != 'nan':
          ztt.append(i) 
  ztt
  </code></pre>
  
  <p>or:</p>
  
  <pre><code>ztt = []
  for i in z:
      if i != np.nan:
          ztt.append(i) 
  ztt
  </code></pre>
  
  <p>I am still getting the output:</p>
  
  <pre><code>[[46.0, 34.0, 32.0, 40.0, 34.0, 29.0, 38.0, 39.0, 45.0, 32.0, 28.0, 43.0],
   [32.0, 30.0, 67.0, 66.0, 28.0, 19.0, 39.0, 32.0, 51.0, 28.0, 20.0, 36.0],
   [29.0, 24.0, 37.0, 31.0, 32.0, 34.0, 28.0, 31.0, 28.0, 33.0, 28.0, 39.0],
   [27.0, 29.0, 35.0, nan, nan, nan, nan, nan, nan, nan, nan, nan]]
  </code></pre>
  
  <p>Anyone know what is going wrong?</p>