code: def test_unknown_shapes_n_components_larger_than_num_rows(solver):
      X = np.random.randn(2, 10)
      df = pd.DataFrame(X)
      ddf = dask.dataframe.from_pandas(df, npartitions=2)
      X = ddf.values
      assert np.isnan(X.shape[0])
  
      pca = dd.PCA(n_components=3, svd_solver=solver)
      if solver == "randomized":
          with pytest.raises(
              ValueError,
              match="n_components=3 is larger than the number of singular values",
          ) as error:
              pca.fit(X)
          assert "PCA has attributes as if n_components == 2" in str(
              error.value
          )
          assert pca.n_components_ == 2
          assert len(pca.singular_values_) == 2
          assert len(pca.components_) == 2
          assert pca.n_features_in_ == 10
          assert pca.n_samples_ == 2
          if solver != "randomized":
              assert pca.explained_variance_ratio_.max() == 1.0
      else:
          if DASK_2_26_0:
              # With dask 2.26.0+, tsqr will no longer throw an error related to svd_flip
              # when inputs have more columns than rows so the expected failure here
              # should come when the number of components is checked against the number
              # of singular values, i.e. this is the error that should get thrown
              with pytest.raises(
                  ValueError,
                  match="n_components=3 is larger than the number of singular values",
              ):
                  pca.fit(X)
          else:
              # Prior to dask 2.26.0, the error being wrapped and rethrown as a
              # problem related to having too many components was actually caused
              # by there being more columns than rows in the input data
              with pytest.raises(
                  ValueError, match="n_components is too large"
              ):
                  pca.fit(X)
  
imports: from itertools import product
  import dask.array
  import dask.dataframe
  import numpy
  import pandas
  import pytest
  import scipy
  import sklearn.decomposition
  from dask.array.utils import assert_eq
  from numpy.testing import assert_almost_equal, assert_array_almost_equal, assert_raises
  from sklearn import datasets
  from sklearn.utils import check_random_state
  import dask_ml.decomposition
  from dask_ml._compat import DASK_2_26_0
  from dask_ml.utils import assert_estimator_equal, flip_vector_signs, svd_flip
label_desc: Use image node_id 31 for calling a global function with example usage: test_unknown_shapes_n_components_larger_than_num_rows(solver) without return types