title: Different kinds of 'nan' in Python
body: <p>In the following examples, I create four types of 'nan' in Python. <code>df</code> in <code>a</code> is a data frame I loaded from a .txt file where one missing values sit on [2,2].</p>
  <pre><code>a = df.iloc[2,2]
  b = pd.NA
  c = np.nan
  d = float('nan')
  </code></pre>
  <p>First, I had a look at these four values:</p>
  <pre><code>a
  Out[122]: nan
  b
  Out[123]: &lt;NA&gt;
  c
  Out[124]: nan
  d
  Out[125]: nan
  </code></pre>
  <p>It looks like a,c and d are equal <code>nan</code> values, And I decided to check their type:</p>
  <pre><code>type(a)
  Out[116]: numpy.float64
  type(b)
  Out[117]: pandas._libs.missing.NAType
  type(c)
  Out[118]: float
  type(d)
  Out[119]: float
  </code></pre>
  <p>I want to check if they are equal in a sense:</p>
  <pre><code>c == d
  Out[120]: False
  a == d
  Out[121]: False
  a == c
  Out[126]: False
  </code></pre>
  <p>My question is:</p>
  <p>[1] Why c and d are not equal?</p>
  <p>[2] Is there a way to convert float('nan') to np.nan?</p>
  <p>[3] Is there a way to convert <code>a</code> to np.nan?</p>
  <p>Many thanks!</p>