code: def test_grouped_estimator_PCA(self):
      df = pdml.ModelFrame(datasets.load_iris())
      grouped = df.groupby(".target")
      self.assertIsInstance(
          grouped, pdml.core.groupby.ModelFrameGroupBy
      )
      for name, group in grouped:
          self.assertIsInstance(group, pdml.ModelFrame)
          self.assertEqual(group.target_name, ".target")
          self.assertTrue(group.has_target())
          tm.assert_index_equal(group.columns, df.columns)
      pca = df.decomposition.PCA()
      gclf = grouped.fit(pca)
      self.assertIsInstance(gclf, pdml.core.groupby.GroupedEstimator)
      self.assertEqual(len(gclf.groups), 3)
  
      results = grouped.transform(gclf)
      self.assertIsInstance(
          results, pdml.core.groupby.ModelFrameGroupBy
      )
  
      self.assertIsInstance(results.get_group(0), pdml.ModelFrame)
      self.assertIsInstance(results.get_group(1), pdml.ModelFrame)
      self.assertIsInstance(results.get_group(2), pdml.ModelFrame)
      # test indexes are preserved
      tm.assert_index_equal(
          results.get_group(0).index, grouped.get_group(0).index
      )
      tm.assert_index_equal(
          results.get_group(1).index, grouped.get_group(1).index
      )
      tm.assert_index_equal(
          results.get_group(2).index, grouped.get_group(2).index
      )
  
      import sklearn.decomposition as dc
  
      for i in range(3):
          group = df[df[".target"] == i]
          pca = dc.PCA()
          pca.fit(group.data.values)
          expected = pca.transform(group.data.values)
          result = results.get_group(i).data
          self.assert_numpy_array_almost_equal(result.values, expected)
  
file_path: pandas-ml/pandas_ml/test/test_groupby.py
imports: import numpy
  import pandas
  import sklearn.datasets
  import pandas_ml
  import pandas_ml.util.testing
label_desc: Use image node_id 4 for calling the TestModelFrameGroupBy obj's underlying member method code with example usage: obj.test_grouped_estimator_PCA() without return types