title: How can I drop non string type 'nan' from list
body: <p>I have the data coming from the field. It is in list format. The elements are float. Some unexpected character like <code>nan</code> is seen in the list. But it is not in string format. I tried existing solutions but failed to remove them.</p>
  <p>My code:</p>
  <pre><code>lst = [1.2,2.3,nan]
  
  newlst = [x for x in lst if str(x) != 'nan']
  </code></pre>
  <p>Present output:</p>
  <pre><code>NameError: name 'nan' is not defined
  </code></pre>
  <p>Expected output:</p>
  <pre><code>newlst = [1.2,2.3]
  </code></pre>