NaN in mapper - name 'nan' is not defined
<p>I do as below</p>

<pre><code>mapper = {'a': 'b', 'c': nan, 'd': 'e',  nan : nan}
df['b'] = [ mapper[x] for x in df['a'] ]
df['b'].value_counts()
</code></pre>

<p>and</p>

<pre><code>NameError                                 Traceback (most recent call last)
&lt;ipython-input-48-3862b2347ce7&gt; in &lt;module&gt;()
NameError: name 'nan' is not defined
</code></pre>

<p>What's wrong? Is a mistake in coding or in file? </p>