PCA.fit_transform() failing

### Describe the bug

I have data in a numpy array of shape (2970, 291) that contains `NaN` and `inf` values. `np.nan_to_num()` was called on the array prior to `fit_transform()` within the function provided below but `ValueError: array must not contain infs or NaNs` was raised instead. The issue however is not reproduceable on an array created using `np.random.rand(2970, 291)`.

### Steps/Code to Reproduce

```
def reduce_dims(data):

    data = np.nan_to_num(data)

    print(np.isnan(data).any())
    print(np.isinf(data).any())
    print()

    decomposer = PCA()

    return decomposer.fit_transform(data).T

data_test = np.random.rand(2970, 291)
t = reduce_dims(data_test)
```

### Expected Results

I should be getting an array with shape (2970, n_PCs).

### Actual Results

```
False
False

C:\Users\Admin\anaconda3\envs\DeepLearning\lib\site-packages\numpy\core\fromnumeric.py:86: RuntimeWarning: overflow encountered in reduce
  return ufunc.reduce(obj, axis, dtype, out, **passkwargs)
C:\Users\Admin\anaconda3\envs\DeepLearning\lib\site-packages\numpy\core\_methods.py:179: RuntimeWarning: overflow encountered in reduce
  ret = umr_sum(arr, axis, dtype, out, keepdims, where=where)
Traceback (most recent call last):

  File "C:\Users\Admin\OneDrive\Desktop\Project\Main.py", line 142, in <module>
    t = reduce_dims(data.T)

  File "C:\Users\Admin\OneDrive\Desktop\Project\Main.py", line 134, in map_ss
    return decomposer.fit_transform(data).T

  File "C:\Users\Admin\anaconda3\envs\DeepLearning\lib\site-packages\sklearn\decomposition\_pca.py", line 407, in fit_transform
    U, S, Vt = self._fit(X)

  File "C:\Users\Admin\anaconda3\envs\DeepLearning\lib\site-packages\sklearn\decomposition\_pca.py", line 457, in _fit
    return self._fit_full(X, n_components)

  File "C:\Users\Admin\anaconda3\envs\DeepLearning\lib\site-packages\sklearn\decomposition\_pca.py", line 492, in _fit_full
    U, S, Vt = linalg.svd(X, full_matrices=False)

  File "C:\Users\Admin\anaconda3\envs\DeepLearning\lib\site-packages\scipy\linalg\_decomp_svd.py", line 108, in svd
    a1 = _asarray_validated(a, check_finite=check_finite)

  File "C:\Users\Admin\anaconda3\envs\DeepLearning\lib\site-packages\scipy\_lib\_util.py", line 287, in _asarray_validated
    a = toarray(a)

  File "C:\Users\Admin\anaconda3\envs\DeepLearning\lib\site-packages\numpy\lib\function_base.py", line 603, in asarray_chkfinite
    raise ValueError(

ValueError: array must not contain infs or NaNs
```

### Versions

```shell
System:
    python: 3.10.2 | packaged by conda-forge | (main, Mar  8 2022, 15:52:24) [MSC v.1929 64 bit (AMD64)]
executable: C:\Users\Admin\anaconda3\envs\DeepLearning\python.exe
   machine: Windows-10-10.0.19044-SP0

Python dependencies:
          pip: 22.0.4
   setuptools: 60.9.3
      sklearn: 1.0.2
        numpy: 1.22.3
        scipy: 1.8.0
       Cython: None
       pandas: 1.4.1
   matplotlib: 3.5.1
       joblib: 1.1.0
threadpoolctl: 3.1.0

Built with OpenMP: True
C:\Users\Admin\anaconda3\envs\DeepLearning\lib\site-packages\_distutils_hack\__init__.py:30: UserWarning: Setuptools is replacing distutils.
  warnings.warn("Setuptools is replacing distutils.")
```

COMMENT:
It's possible that scipy has a fast check for infinite values that consist in summing all elements and check if the result is finite.
by default `nan_to_num` replaces inf by very large numbers. See the doc
```
posinf : int, float, optional

    Value to be used to fill positive infinity values. If no value is passed then positive infinity values will be replaced with a very large number.
```
Could you try the same thing but setting `posinf` and `neginf` to a fixed not too large value ? Or even 0 you you want to treat nans and infs the same way.

Labels: Bug, Needs Triage