code: def test_grouped_estimator_SVC(self):
      df = pdml.ModelFrame(datasets.load_iris())
      df["sepal length (cm)"] = df["sepal length (cm)"].pp.binarize(
          threshold=5.8
      )
      grouped = df.groupby("sepal length (cm)")
      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)
      svc = df.svm.SVC(random_state=self.random_state)
      gclf = grouped.fit(svc)
      self.assertIsInstance(gclf, pdml.core.groupby.GroupedEstimator)
      self.assertEqual(len(gclf.groups), 2)
  
      results = grouped.predict(gclf)
      self.assertIsInstance(
          results, pdml.core.groupby.ModelSeriesGroupBy
      )
      self.assertIsInstance(results.get_group(0), pdml.ModelSeries)
      self.assertIsInstance(results.get_group(1), pdml.ModelSeries)
      # 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
      )
  
      import sklearn.svm as svm
  
      svc1 = svm.SVC(random_state=self.random_state)
      svc2 = svm.SVC(random_state=self.random_state)
  
      group1 = df[df["sepal length (cm)"] == 0]
      svc1.fit(group1.data.values, group1.target.values)
      expected1 = svc1.predict(group1.data.values)
  
      group2 = df[df["sepal length (cm)"] == 1]
      svc2.fit(group2.data.values, group2.target.values)
      expected2 = svc2.predict(group2.data.values)
  
      tm.assert_numpy_array_equal(
          results.get_group(0).values, expected1
      )
      tm.assert_numpy_array_equal(
          results.get_group(1).values, expected2
      )
  
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 3 for calling the TestModelFrameGroupBy obj's underlying member method code with example usage: obj.test_grouped_estimator_SVC() without return types