code: def pubdev_6394():
      # JUnit tests are to be found in RapidsTest class
  
      data = [
          ["location"],
          ["Ｘ県 Ａ市"],
          ["Ｘ県 Ｂ市"],
          ["Ｘ県 Ｂ市"],
          ["Ｙ県 Ｃ市"],
          ["Ｙ県 Ｃ市"],
      ]
  
      original_frame = H2OFrame(
          data, header=True, column_types=["enum"]
      )
  
      assert original_frame.type("location") == "enum"
      assert original_frame.categories() == ["Ｘ県 Ａ市", "Ｘ県 Ｂ市", "Ｙ県 Ｃ市"]
  
      # Reduce cardinality of 'location' column to 2 by reducing existing categorical values to ['Ｘ県','Y県']
      expected_categories = ["Ｘ県", "Ｙ県"]
      transformed_frame = original_frame["location"].gsub(" .*", "")
      print(transformed_frame)
  
      assert transformed_frame.ncols == 1
      assert transformed_frame.nrows == original_frame.nrows
      assert transformed_frame.type("C1") == "enum"
      assert transformed_frame["C1"].categories() == expected_categories
  
      # Test gsub without changing the cardinality
  
      data = [["location"], ["ab"], ["ac"], ["ad"], ["ae"], ["af"]]
  
      original_frame = H2OFrame(
          data, header=True, column_types=["enum"]
      )
      assert original_frame.type("location") == "enum"
      assert original_frame.categories() == [
          "ab",
          "ac",
          "ad",
          "ae",
          "af",
      ]
  
      expected_categories = ["b", "c", "d", "e", "f"]
      transformed_frame = original_frame["location"].gsub("a", "")
      print(transformed_frame)
  
      assert transformed_frame.ncols == 1
      assert transformed_frame.nrows == original_frame.nrows
      assert transformed_frame.type("C1") == "enum"
      assert transformed_frame["C1"].categories() == expected_categories
  
label_desc: Use image node_id 1 for calling a global function with example usage: pubdev_6394() without return types