<h4 dir="auto">Describe the bug</h4>

<p dir="auto">When using an imputer, after training on a data frame with at least one of the columns completely missing, the imputer will drop this feature after a transform.</p>
<p dir="auto">I would expect at least a warning or an option to fall back to a constant value fill.</p>
<h4 dir="auto">Steps/Code to Reproduce</h4>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="import pandas as pd
from sklearn.impute import SimpleImputer
df = pd.DataFrame({'a':[1,2,3],'b':[None,None,None]})
print(SimpleImputer().fit_transform(df).shape)"><pre class="notranslate"><code class="notranslate">import pandas as pd
from sklearn.impute import SimpleImputer
df = pd.DataFrame({'a':[1,2,3],'b':[None,None,None]})
print(SimpleImputer().fit_transform(df).shape)
</code></pre></div>
<h4 dir="auto">Expected Results</h4>

<p dir="auto">(3, 2)</p>
<h4 dir="auto">Actual Results</h4>

<p dir="auto">(3, 1)</p>
<h4 dir="auto">Versions</h4>
<h3 dir="auto">Code sample</h3>
<p dir="auto">In the sample code below, a column is removed from the dataset during the pipeline</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="&gt;&gt;&gt; from sklearn.impute import SimpleImputer
&gt;&gt;&gt; import numpy as np
&gt;&gt;&gt; imp = SimpleImputer()
&gt;&gt;&gt; imp.fit([[0, np.nan], [1, np.nan]])
&gt;&gt;&gt; imp.transform([[0, np.nan], [1, 1]])
array([[0.],
       [1.]])"><pre class="notranslate"><span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-k">from</span> <span class="pl-s1">sklearn</span>.<span class="pl-s1">impute</span> <span class="pl-k">import</span> <span class="pl-v">SimpleImputer</span>
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</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-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">imp</span> <span class="pl-c1">=</span> <span class="pl-v">SimpleImputer</span>()
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">imp</span>.<span class="pl-en">fit</span>([[<span class="pl-c1">0</span>, <span class="pl-s1">np</span>.<span class="pl-s1">nan</span>], [<span class="pl-c1">1</span>, <span class="pl-s1">np</span>.<span class="pl-s1">nan</span>]])
<span class="pl-c1">&gt;&gt;</span><span class="pl-c1">&gt;</span> <span class="pl-s1">imp</span>.<span class="pl-en">transform</span>([[<span class="pl-c1">0</span>, <span class="pl-s1">np</span>.<span class="pl-s1">nan</span>], [<span class="pl-c1">1</span>, <span class="pl-c1">1</span>]])
<span class="pl-en">array</span>([[<span class="pl-c1">0.</span>],
       [<span class="pl-c1">1.</span>]])</pre></div>
<h3 dir="auto">Problem description</h3>
<p dir="auto">Currently <code class="notranslate">sklearn.impute.SimpleImputer</code> silently removes features that are <code class="notranslate">np.nan</code> on every training sample.</p>
<p dir="auto">This may cause further issues on pipelines because the dataset's <code class="notranslate">shape</code> has changed, e.g.</p>
<div class="highlight highlight-source-python notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="dataset[:, columns_to_impute_with_median] = imp.fit_transform(dataset[:, columns_to_impute_with_median])"><pre class="notranslate"><span class="pl-s1">dataset</span>[:, <span class="pl-s1">columns_to_impute_with_median</span>] <span class="pl-c1">=</span> <span class="pl-s1">imp</span>.<span class="pl-en">fit_transform</span>(<span class="pl-s1">dataset</span>[:, <span class="pl-s1">columns_to_impute_with_median</span>])</pre></div>
<h3 dir="auto">Possible solutions</h3>
<p dir="auto">For the problematic features, either keep their values if valid or impute the <code class="notranslate">fill_value</code> during <code class="notranslate">transform</code>. I suggest adding a new parameter to trigger this behaviour with a warning highlighting the referred features.</p>
<p dir="auto">As I'm willing to implement this feature, I look forward advices.</p>