code: def _transform_csv(data_array, output_path, names, separator=","):
      """Transform csv to a regularized format.
  
      Args:
        input_path: The path of the raw csv.
        output_path: The path of the cleaned csv.
        names: The csv column names.
        separator: Character used to separate fields in the raw csv.
      """
      if six.PY2:
          names = [six.ensure_text(n, "utf-8") for n in names]
  
      with tf.io.gfile.GFile(output_path, "wb") as f_out:
          # Write column names to the csv.
          f_out.write(",".join(names).encode("utf-8"))
          f_out.write(b"\n")
          counter = 0
          for chunk in data_array:
              for i in range(chunk.shape[0]):
                  user_id = str(chunk[i][0] + 1)
                  item_id = str(chunk[i][1] + 1)
                  rating = str(1.0)
                  timestamp = "1112484727\n"
                  # line = six.ensure_text(line, "utf-8", errors="ignore")
                  fields = [user_id, item_id, rating, timestamp]
                  # fields = line.split(separator)
                  if separator != ",":
                      fields = [
                          '"{}"'.format(field)
                          if "," in field
                          else field
                          for field in fields
                      ]
                  f_out.write(",".join(fields).encode("utf-8"))
                  counter += 1
                  if counter % 1000000 == 0:
                      print(
                          "Have written {} ({}%) record.".format(
                              counter,
                              float(counter) / 1223962043.0 * 100,
                          )
                      )
                  # if counter == 20000:
                  #       return
      return
  
file_path: autodist/examples/benchmark/utils/recommendation/transform_npz.py
imports: from argparse import ArgumentParser
  from datetime import datetime
  import numpy
  import six
  import tensorflow
  from utils.recommendation.movielens import RATING_COLUMNS
label_desc: Use image node_id 2 for calling a global function with example usage: _transform_csv(data_array, output_path, names, separator) without return types