<h4 dir="auto">Describe the bug</h4>
<p dir="auto">There is an issue when using <code class="notranslate">SimpleImputer</code> with a new Pandas dataframe, specifically if it has a column that is of type <code class="notranslate">Int64</code> and has a <code class="notranslate">NA</code> value in the training data.</p>
<h4 dir="auto">Code to Reproduce</h4>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="def test_simple_imputer_with_Int64_column():
    index = pd.Index(['A', 'B', 'C'], name='group')
    df = pd.DataFrame({
        'att-1': [10, 20, np.nan],
        'att-2': [30, 40, 30]
    }, index=index)

    # TODO: This line breaks the test! Comment out and it works
    df = df.astype('Int64')

    imputer = SimpleImputer()
    imputer.fit(df)
    imputed = imputer.transform(df)
    df_imputed = pd.DataFrame(imputed, columns=['att-1', 'att-2'], index=index)

    assert df_imputed.loc['C', 'att-1'] == 15"><pre class="notranslate"><span class="pl-k">def</span> <span class="pl-en">test_simple_imputer_with_Int64_column</span>():
    <span class="pl-s1">index</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">Index</span>([<span class="pl-s">'A'</span>, <span class="pl-s">'B'</span>, <span class="pl-s">'C'</span>], <span class="pl-s1">name</span><span class="pl-c1">=</span><span class="pl-s">'group'</span>)
    <span class="pl-s1">df</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>({
        <span class="pl-s">'att-1'</span>: [<span class="pl-c1">10</span>, <span class="pl-c1">20</span>, <span class="pl-s1">np</span>.<span class="pl-s1">nan</span>],
        <span class="pl-s">'att-2'</span>: [<span class="pl-c1">30</span>, <span class="pl-c1">40</span>, <span class="pl-c1">30</span>]
    }, <span class="pl-s1">index</span><span class="pl-c1">=</span><span class="pl-s1">index</span>)

    <span class="pl-c"># TODO: This line breaks the test! Comment out and it works</span>
    <span class="pl-s1">df</span> <span class="pl-c1">=</span> <span class="pl-s1">df</span>.<span class="pl-en">astype</span>(<span class="pl-s">'Int64'</span>)

    <span class="pl-s1">imputer</span> <span class="pl-c1">=</span> <span class="pl-v">SimpleImputer</span>()
    <span class="pl-s1">imputer</span>.<span class="pl-en">fit</span>(<span class="pl-s1">df</span>)
    <span class="pl-s1">imputed</span> <span class="pl-c1">=</span> <span class="pl-s1">imputer</span>.<span class="pl-en">transform</span>(<span class="pl-s1">df</span>)
    <span class="pl-s1">df_imputed</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>(<span class="pl-s1">imputed</span>, <span class="pl-s1">columns</span><span class="pl-c1">=</span>[<span class="pl-s">'att-1'</span>, <span class="pl-s">'att-2'</span>], <span class="pl-s1">index</span><span class="pl-c1">=</span><span class="pl-s1">index</span>)

    <span class="pl-k">assert</span> <span class="pl-s1">df_imputed</span>.<span class="pl-s1">loc</span>[<span class="pl-s">'C'</span>, <span class="pl-s">'att-1'</span>] <span class="pl-c1">==</span> <span class="pl-c1">15</span></pre></div>
<h4 dir="auto">Expected Results</h4>
<p dir="auto">Correct value is imputed</p>
<h4 dir="auto">Actual Results</h4>
<p dir="auto">Exception raised:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TypeError: float() argument must be a string or a number, not 'NAType'"><pre class="notranslate"><code class="notranslate">TypeError: float() argument must be a string or a number, not 'NAType'
</code></pre></div>
<h4 dir="auto">Versions</h4>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="System:
    python: 3.7.4 (default, Aug 13 2019, 15:17:50)  [Clang 4.0.1 (tags/RELEASE_401/final)]
executable: &lt;path-to-my-project&gt;/.venv/bin/python
   machine: Darwin-19.3.0-x86_64-i386-64bit
Python dependencies:
       pip: 19.3.1
setuptools: 42.0.2
   sklearn: 0.22.1
     numpy: 1.18.1
     scipy: 1.4.1
    Cython: None
    pandas: 1.0.1
matplotlib: None
    joblib: 0.14.1
Built with OpenMP: True"><pre class="notranslate"><code class="notranslate">System:
    python: 3.7.4 (default, Aug 13 2019, 15:17:50)  [Clang 4.0.1 (tags/RELEASE_401/final)]
executable: &lt;path-to-my-project&gt;/.venv/bin/python
   machine: Darwin-19.3.0-x86_64-i386-64bit
Python dependencies:
       pip: 19.3.1
setuptools: 42.0.2
   sklearn: 0.22.1
     numpy: 1.18.1
     scipy: 1.4.1
    Cython: None
    pandas: 1.0.1
matplotlib: None
    joblib: 0.14.1
Built with OpenMP: True
</code></pre></div>
<h4 dir="auto">Describe the bug</h4>
<p dir="auto"><a href="https://pandas.pydata.org/pandas-docs/stable/user_guide/missing_data.html#missing-data-na" rel="nofollow">Starting from pandas 1.0, an experimental pd.NA value (singleton) is available to represent scalar missing values. At this moment, it is used in the nullable integer, boolean and dedicated string data types as the missing value indicator.<br>
</a></p>
<p dir="auto">I get the error <code class="notranslate">TypeError: float() argument must be a string or a number, not 'NAType'</code> when transfer integer data containing NaN in the form of a pandas dataframe to preprocessing module, in particular QuantileTransformer and StandardScaler after updating pandas to the current version.</p>
<h4 dir="auto">Steps/Code to Reproduce</h4>
<p dir="auto">Example:</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="import pandas as pd
import numpy as np
from sklearn.preprocessing import StandardScaler

df = pd.DataFrame({'a': [1,2,3, np.nan, np.nan], 
                   'b': [np.nan, np.nan, 8, 4, 6]}, 
                  dtype = pd.Int64Dtype())

scaler = StandardScaler() 
scaler.fit_transform(df)"><pre class="notranslate"><span class="pl-k">import</span> <span class="pl-s1">pandas</span> <span class="pl-k">as</span> <span class="pl-s1">pd</span>
<span class="pl-k">import</span> <span class="pl-s1">numpy</span> <span class="pl-k">as</span> <span class="pl-s1">np</span>
<span class="pl-k">from</span> <span class="pl-s1">sklearn</span>.<span class="pl-s1">preprocessing</span> <span class="pl-k">import</span> <span class="pl-v">StandardScaler</span>

<span class="pl-s1">df</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">DataFrame</span>({<span class="pl-s">'a'</span>: [<span class="pl-c1">1</span>,<span class="pl-c1">2</span>,<span class="pl-c1">3</span>, <span class="pl-s1">np</span>.<span class="pl-s1">nan</span>, <span class="pl-s1">np</span>.<span class="pl-s1">nan</span>], 
                   <span class="pl-s">'b'</span>: [<span class="pl-s1">np</span>.<span class="pl-s1">nan</span>, <span class="pl-s1">np</span>.<span class="pl-s1">nan</span>, <span class="pl-c1">8</span>, <span class="pl-c1">4</span>, <span class="pl-c1">6</span>]}, 
                  <span class="pl-s1">dtype</span> <span class="pl-c1">=</span> <span class="pl-s1">pd</span>.<span class="pl-v">Int64Dtype</span>())

<span class="pl-s1">scaler</span> <span class="pl-c1">=</span> <span class="pl-v">StandardScaler</span>() 
<span class="pl-s1">scaler</span>.<span class="pl-en">fit_transform</span>(<span class="pl-s1">df</span>)</pre></div>
<h4 dir="auto">Expected Results</h4>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="array([[-1.22474487,         nan],
       [ 0.        ,         nan],
       [ 1.22474487,  1.22474487],
       [        nan, -1.22474487],
       [        nan,  0.        ]])"><pre class="notranslate"><code class="notranslate">array([[-1.22474487,         nan],
       [ 0.        ,         nan],
       [ 1.22474487,  1.22474487],
       [        nan, -1.22474487],
       [        nan,  0.        ]])
</code></pre></div>
<h4 dir="auto">Actual Results</h4>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TypeError                                 Traceback (most recent call last)
&lt;ipython-input-42-2104609ef9c0&gt; in &lt;module&gt;
      7 print(df)
      8 scaler = StandardScaler()
----&gt; 9 scaler.fit_transform(df)

/anaconda3/lib/python3.6/site-packages/sklearn/base.py in fit_transform(self, X, y, **fit_params)
    569         if y is None:
    570             # fit method of arity 1 (unsupervised transformation)
--&gt; 571             return self.fit(X, **fit_params).transform(X)
    572         else:
    573             # fit method of arity 2 (supervised transformation)

/anaconda3/lib/python3.6/site-packages/sklearn/preprocessing/_data.py in fit(self, X, y)
    667         # Reset internal state before fitting
    668         self._reset()
--&gt; 669         return self.partial_fit(X, y)
    670 
    671     def partial_fit(self, X, y=None):

/anaconda3/lib/python3.6/site-packages/sklearn/preprocessing/_data.py in partial_fit(self, X, y)
    698         X = check_array(X, accept_sparse=('csr', 'csc'),
    699                         estimator=self, dtype=FLOAT_DTYPES,
--&gt; 700                         force_all_finite='allow-nan')
    701 
    702         # Even in the case of `with_mean=False`, we update the mean anyway

/anaconda3/lib/python3.6/site-packages/sklearn/utils/validation.py in check_array(array, accept_sparse, accept_large_sparse, dtype, order, copy, force_all_finite, ensure_2d, allow_nd, ensure_min_samples, ensure_min_features, warn_on_dtype, estimator)
    529                     array = array.astype(dtype, casting=&quot;unsafe&quot;, copy=False)
    530                 else:
--&gt; 531                     array = np.asarray(array, order=order, dtype=dtype)
    532             except ComplexWarning:
    533                 raise ValueError(&quot;Complex data not supported\n&quot;

/anaconda3/lib/python3.6/site-packages/numpy/core/_asarray.py in asarray(a, dtype, order)
     83 
     84     &quot;&quot;&quot;
---&gt; 85     return array(a, dtype, copy=False, order=order)
     86 
     87 

TypeError: float() argument must be a string or a number, not 'NAType'"><pre class="notranslate"><code class="notranslate">TypeError                                 Traceback (most recent call last)
&lt;ipython-input-42-2104609ef9c0&gt; in &lt;module&gt;
      7 print(df)
      8 scaler = StandardScaler()
----&gt; 9 scaler.fit_transform(df)

/anaconda3/lib/python3.6/site-packages/sklearn/base.py in fit_transform(self, X, y, **fit_params)
    569         if y is None:
    570             # fit method of arity 1 (unsupervised transformation)
--&gt; 571             return self.fit(X, **fit_params).transform(X)
    572         else:
    573             # fit method of arity 2 (supervised transformation)

/anaconda3/lib/python3.6/site-packages/sklearn/preprocessing/_data.py in fit(self, X, y)
    667         # Reset internal state before fitting
    668         self._reset()
--&gt; 669         return self.partial_fit(X, y)
    670 
    671     def partial_fit(self, X, y=None):

/anaconda3/lib/python3.6/site-packages/sklearn/preprocessing/_data.py in partial_fit(self, X, y)
    698         X = check_array(X, accept_sparse=('csr', 'csc'),
    699                         estimator=self, dtype=FLOAT_DTYPES,
--&gt; 700                         force_all_finite='allow-nan')
    701 
    702         # Even in the case of `with_mean=False`, we update the mean anyway

/anaconda3/lib/python3.6/site-packages/sklearn/utils/validation.py in check_array(array, accept_sparse, accept_large_sparse, dtype, order, copy, force_all_finite, ensure_2d, allow_nd, ensure_min_samples, ensure_min_features, warn_on_dtype, estimator)
    529                     array = array.astype(dtype, casting="unsafe", copy=False)
    530                 else:
--&gt; 531                     array = np.asarray(array, order=order, dtype=dtype)
    532             except ComplexWarning:
    533                 raise ValueError("Complex data not supported\n"

/anaconda3/lib/python3.6/site-packages/numpy/core/_asarray.py in asarray(a, dtype, order)
     83 
     84     """
---&gt; 85     return array(a, dtype, copy=False, order=order)
     86 
     87 

TypeError: float() argument must be a string or a number, not 'NAType'
</code></pre></div>
<h4 dir="auto">Versions</h4>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="System:
    python: 3.6.10 |Anaconda, Inc.| (default, Jan  7 2020, 15:01:53)  [GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]
executable: /anaconda3/bin/python
   machine: Darwin-17.7.0-x86_64-i386-64bit

Python dependencies:
       pip: 20.0.2
setuptools: 45.2.0.post20200210
   sklearn: 0.22.1
     numpy: 1.18.1
     scipy: 1.4.1
    Cython: None
    pandas: 1.0.1
matplotlib: 3.1.3
    joblib: 0.14.1

Built with OpenMP: True"><pre class="notranslate"><code class="notranslate">System:
    python: 3.6.10 |Anaconda, Inc.| (default, Jan  7 2020, 15:01:53)  [GCC 4.2.1 Compatible Clang 4.0.1 (tags/RELEASE_401/final)]
executable: /anaconda3/bin/python
   machine: Darwin-17.7.0-x86_64-i386-64bit

Python dependencies:
       pip: 20.0.2
setuptools: 45.2.0.post20200210
   sklearn: 0.22.1
     numpy: 1.18.1
     scipy: 1.4.1
    Cython: None
    pandas: 1.0.1
matplotlib: 3.1.3
    joblib: 0.14.1

Built with OpenMP: True
</code></pre></div>