class_docstr: Serialize data of various formats to a CSV-formatted string.
docstr: Serialize data as a CSV-formatted row.
  
  Args:
      data (object): Data to be serialized in a row.
  
  Returns:
      str: The data serialized as a CSV-formatted row.
docstr_tok: ["Serialize","data","as","a","CSV-formatted","row",".","Args",":","data","(","object",")",":","Data","to","be","serialized","in","a","row",".","Returns",":","str",":","The","data","serialized","as","a","CSV-formatted","row","."]
code: def _serialize_row(self, data):
      """Serialize data as a CSV-formatted row.
  
      Args:
          data (object): Data to be serialized in a row.
  
      Returns:
          str: The data serialized as a CSV-formatted row.
      """
      if isinstance(data, str):
          return data
  
      if isinstance(data, np.ndarray):
          data = np.ndarray.flatten(data)
  
      if hasattr(data, "__len__"):
          if len(data) == 0:
              raise ValueError("Cannot serialize empty array")
          csv_buffer = io.StringIO()
          csv_writer = csv.writer(csv_buffer, delimiter=",")
          csv_writer.writerow(data)
          return csv_buffer.getvalue().rstrip("\r\n")
  
      raise ValueError("Unable to handle input format: %s" % type(data))
  
imports: from __future__ import absolute_import
  import abc
  from collections.abc import Iterable
  import csv
  import io
  import json
  import numpy
  from pandas import DataFrame
  from six import with_metaclass
  from sagemaker.utils import DeferredError
label_desc: Use image node_id 3 for calling the CSVSerializer obj's underlying member method code with example usage: obj._serialize_row(data) and returns: data, csv_buffer