code: def test_binarize(self):
      iris = datasets.load_iris()
      df = pdml.ModelFrame(iris)
  
      result = df.preprocessing.binarize()
      expected = pp.binarize(iris.data)
  
      self.assertIsInstance(result, pdml.ModelFrame)
      self.assert_numpy_array_almost_equal(result.data.values, expected)
      tm.assert_index_equal(result.columns, df.data.columns)
  
      result = df.preprocessing.binarize(threshold=5)
      expected = pp.binarize(iris.data, threshold=5)
  
      self.assertIsInstance(result, pdml.ModelFrame)
      self.assert_numpy_array_almost_equal(result.data.values, expected)
      tm.assert_index_equal(result.columns, df.data.columns)
  
      s = df["sepal length (cm)"]
      self.assertIsInstance(s, pdml.ModelSeries)
      result = s.preprocessing.binarize()
      expected = pp.binarize(iris.data[:, 0].reshape(-1, 1))
  
      self.assertIsInstance(result, pdml.ModelSeries)
      self.assert_numpy_array_almost_equal(
          result.values, expected.flatten()
      )
      self.assertEqual(result.name, "sepal length (cm)")
  
      result = s.preprocessing.binarize(threshold=6)
      expected = pp.binarize(
          iris.data[:, 0].reshape(-1, 1), threshold=6
      )
  
      self.assertIsInstance(result, pdml.ModelSeries)
      self.assert_numpy_array_almost_equal(
          result.values, expected.flatten()
      )
      self.assertEqual(result.name, "sepal length (cm)")
  
imports: import pytest
  import numpy
  import pandas
  import sklearn.datasets
  import sklearn.preprocessing
  import pandas_ml
  import pandas_ml.util.testing
label_desc: Use image node_id 3 for calling the TestPreprocessing obj's underlying member method code with example usage: obj.test_binarize() without return types