code: def test_patsy_deviation_coding(self):
      df = pdml.ModelFrame(
          {
              "X": [1, 2, 3, 4, 5],
              "Y": [1, 3, 2, 2, 1],
              "Z": [1, 1, 1, 2, 2],
          },
          target="Z",
          index=["a", "b", "c", "d", "e"],
      )
  
      result = df.transform("C(X, Sum)")
      expected = pd.DataFrame(
          {
              "Intercept": [1, 1, 1, 1, 1],
              "C(X, Sum)[S.1]": [1, 0, 0, 0, -1],
              "C(X, Sum)[S.2]": [0, 1, 0, 0, -1],
              "C(X, Sum)[S.3]": [0, 0, 1, 0, -1],
              "C(X, Sum)[S.4]": [0, 0, 0, 1, -1],
          },
          index=["a", "b", "c", "d", "e"],
          columns=[
              "Intercept",
              "C(X, Sum)[S.1]",
              "C(X, Sum)[S.2]",
              "C(X, Sum)[S.3]",
              "C(X, Sum)[S.4]",
          ],
          dtype=float,
      )
      tm.assert_frame_equal(result, expected)
  
      result = df.transform("C(Y, Sum)")
      expected = pd.DataFrame(
          {
              "Intercept": [1, 1, 1, 1, 1],
              "C(Y, Sum)[S.1]": [1, -1, 0, 0, 1],
              "C(Y, Sum)[S.2]": [0, -1, 1, 1, 0],
          },
          index=["a", "b", "c", "d", "e"],
          columns=["Intercept", "C(Y, Sum)[S.1]", "C(Y, Sum)[S.2]"],
          dtype=float,
      )
      tm.assert_frame_equal(result, expected)
  
file_path: pandas-ml/pandas_ml/misc/test/test_patsy.py
imports: import pandas
  import pandas_ml
  import pandas_ml.util.testing
label_desc: Use image node_id 3 for calling the TestModelFrame obj's underlying member method code with example usage: obj.test_patsy_deviation_coding() without return types