title: Ordinal encoder issues with NaN values
body: <p>I have a dataframe with blank spaces as missing values, so I have replaced them with NaN values by using a regex. The problem that I have is when I want to use ordinal encoding for replacing categorical values. My code so far is the following:</p>
  <pre><code>    x=pd.DataFrame(np.array([30,&quot;lawyer&quot;,&quot;France&quot;,
                               25,&quot;clerk&quot;,&quot;Italy&quot;,
                               22,&quot; &quot;,&quot;Germany&quot;,
                               40,&quot;salesman&quot;,&quot;EEUU&quot;,
                               34,&quot;lawyer&quot;,&quot; &quot;,
                               50,&quot;salesman&quot;,&quot;France&quot;]
                               
              ).reshape(6,3))
      x.columns=[&quot;age&quot;,&quot;job&quot;,&quot;country&quot;]
      x = x.replace(r'^\s*$', np.nan, regex=True)
  
      oe=preprocessing.OrdinalEncoder()
      df.job=oe.fit_transform(df[&quot;job&quot;].values.reshape(-1,1))
  </code></pre>
  <p>I got the following error:</p>
  <pre><code>Input contains NaN
  </code></pre>
  <p>I would like that the job column gets replaced with numbers such as: [1,2,-1,3,1,3].</p>