code: def test_column_coder(self):
      column_configs = [
          {
              "name": "col_a",
              "code_type": "float",
              "args": {
                  "code_len": 4,
                  "base": 16,
                  "fillall": False,
                  "hasnan": True,
                  "transform": "yeo-johnson",
              },
          },
          {
              "name": "col_b",
              "code_type": "float",
              "args": {
                  "code_len": 4,
                  "base": 177,
                  "fillall": True,
                  "hasnan": True,
                  "transform": "quantile",
              },
          },
          {
              "name": "col_c",
              "code_type": "int",
              "args": {
                  "code_len": 3,
                  "base": 12,
                  "fillall": True,
                  "hasnan": True,
              },
          },
          {
              "name": "col_d",
              "code_type": "category",
          },
      ]
  
      example_arrays = {}
      np.random.seed(1234)
  
      array = np.random.random(100)
      example_arrays["col_a"] = array
  
      array = np.random.random(100)
      example_arrays["col_b"] = array
  
      array = np.random.randint(3, 1000, 100)
      example_arrays["col_c"] = array
  
      ALPHABET = np.array(list(string.ascii_lowercase + " "))
      array = np.char.add(
          np.random.choice(ALPHABET, 1000),
          np.random.choice(ALPHABET, 1000),
      )
      example_arrays["col_d"] = array
  
      cc = ColumnCodes.get_column_codes(column_configs, example_arrays)
  
      rr = cc.encode("col_a", "0.323")
      assert np.array_equal(np.array(rr), np.array([49, 32, 29, 15]))
      decoded = cc.decode("col_a", rr)
      assert decoded == "0.3230"
  
      rr = cc.encode("col_b", "0.323")
      assert np.array_equal(
          np.array(rr), np.array([584, 457, 235, 110])
      )
      decoded = cc.decode("col_b", rr)
      assert decoded == "0.3229999"
  
      rr = cc.encode("col_c", "232")
      assert np.array_equal(np.array(rr), np.array([787, 780, 773]))
      decoded = cc.decode("col_c", rr)
      assert decoded == "232"
  
      rr = cc.encode("col_d", "xy")
      assert np.array_equal(np.array(rr), np.array([1313]))
      decoded = cc.decode("col_d", rr)
      assert decoded == "xy"
  
file_path: NeMo/tests/collections/nlp/test_num_encoding.py
imports: import string
  import numpy
  import pytest
  from nemo.collections.common.tokenizers.column_coder import CategoryCode, ColumnCodes, FloatCode, IntCode
label_desc: Use image node_id 4 for calling the TestColumnCoder obj's underlying member method code with example usage: obj.test_column_coder() without return types