StandardScaler and PolynomialFeatures fail on zero-feature inputs during fit (should become passthrough)

### Describe the bug

If you use StandardScaler or PolynomialFeatures (or other transformers, these are the two that hit me first) as elements in  a complex pipeline, an issue comes up if you ever fit these transformers on data that has no features (empty data). This happens a lot when you build a complex pipeline and you don't know what the features will be in advance. For example, in reinforcement learning problems, some problems will have context features while others won't, and we need pipelines for both the action and context features which are then concatenated (using FeatureUnion). My current workaround is that when I try to fit my pipeline, if it fails, it eliminates StandardScalers and PolynomialFeatures because they are a part of the context pipeline and we don't have context features for this problem, then fit again. 

### Steps/Code to Reproduce


from sklearn.preprocessing import StandardScaler, PolynomialFeatures
from sklearn.pipeline import Pipeline

pipeline = Pipeline([
    ('polynomial', PolynomialFeatures()),
    ('fully_transformed_action_and_context', StandardScaler()),
])

pipeline.fit([[]])

### Expected Results

No error is thrown. Pipeline becomes equivalent to passthrough.

### Actual Results

  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/sklearn/pipeline.py", line 390, in fit
    Xt = self._fit(X, y, **fit_params_steps)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/sklearn/pipeline.py", line 348, in _fit
    X, fitted_transformer = fit_transform_one_cached(
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/joblib/memory.py", line 355, in __call__
    return self.func(*args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/sklearn/pipeline.py", line 893, in _fit_transform_one
    res = transformer.fit_transform(X, y, **fit_params)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/sklearn/base.py", line 847, in fit_transform
    return self.fit(X, **fit_params).transform(X)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/sklearn/preprocessing/_polynomial.py", line 287, in fit
    _, n_features = self._validate_data(X, accept_sparse=True).shape
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/sklearn/base.py", line 561, in _validate_data
    X = check_array(X, **check_params)
  File "/Library/Frameworks/Python.framework/Versions/3.8/lib/python3.8/site-packages/sklearn/utils/validation.py", line 806, in check_array
    raise ValueError(
ValueError: Found array with 0 feature(s) (shape=(1, 0)) while a minimum of 1 is required.


### Versions

```shell
System:
    python: 3.8.2 (v3.8.2:7b3ab5921f, Feb 24 2020, 17:52:18)  [Clang 6.0 (clang-600.0.57)]
executable: /usr/local/bin/python3.8
   machine: macOS-10.15.7-x86_64-i386-64bit
Python dependencies:
          pip: 20.0.2
   setuptools: 41.2.0
      sklearn: 1.0.1
        numpy: 1.19.5
        scipy: 1.4.1
       Cython: 0.29.16
       pandas: 1.4.0
   matplotlib: 3.2.1
       joblib: 0.14.1
threadpoolctl: 3.0.0
Built with OpenMP: True
```

COMMENT:
Thank you for giving me a window into the development side of this stuff as I get more practice articulating the problem I'm facing. Here's a better reproduction code exploring both success and failure. The idea here is that I create an empty ColumnTransformer, and then chain it to different subsequent transformers. The whole process is fine if I use passthrough transformers or Function transformers (see last part), but if I use PolynomialFeatures or StandardScaler, I run into issues, forcing me to add branching logic to my pipeline construction, which strikes me as going against the intention of why I employed the pipeline in the first place (a static way of transforming data that can match to different circumstances), but my intentions could be misinformed. It wasn't clear when I started why this was happening, and while the error message eventually got me to sussing out the issue, originally it was buried in a large network of pipelines, column transformers, and feature unions, so it was super confusing at first. I hope this makes sense and can help us make progress on identifying if there's an inconsistency to address:


```
from sklearn.preprocessing import StandardScaler, PolynomialFeatures, FunctionTransformer
from sklearn.pipeline import Pipeline
from sklearn.compose import ColumnTransformer

PolynomialFeatures().fit([[]]) # fails
transformer = PolynomialFeatures().fit([[1]])
transformer.transform([[1]]) # returns [[1, 1, 1]]

transformer = ColumnTransformer([])
transformer.fit([[1]])
transformer.transform([[1]]) # returns empty array of same length as input

transformer = ColumnTransformer([])
transformer_fail = Pipeline([
    ('column_transformer', transformer),
    ('polynomial', PolynomialFeatures()),
])
transformer_fail.fit([[1]]) # fails, because we added the PolynomialFeatures transformer
transformer_fail.transform([[1]]) # fails again


transformer = ColumnTransformer([])
transformer_fail = Pipeline([
    ('column_transformer', transformer),
    ('scaler', StandardScaler()),
])
transformer_fail.fit([[1]]) # fails, because we added the StandardScaler transformer
transformer_fail.transform([[1]]) # fails again


transformer = ColumnTransformer([])
transformer_succeed = Pipeline([
    ('column_transformer', transformer),
    ('function', FunctionTransformer(lambda x: x**2)),
])
transformer_succeed.fit([[1]]) 
transformer_succeed.transform([[1]]) # returns empty array of same length as input
```

Labels: Bug, module:preprocessing