class_docstr: Defines a single training or test example.
  
  Stores each column of the example as an attribute.
class_docstr_tok: ["Defines","a","single","training","or","test","example",".","Stores","each","column","of","the","example","as","an","attribute","."]
code: def fromCSV(cls, data, fields):
      data = data.rstrip("\n")
      # If Python 2, encode to utf-8 since CSV doesn't take unicode input
      if six.PY2:
          data = data.encode("utf-8")
      # Use Python CSV module to parse the CSV line
      parsed_csv_lines = csv.reader([data])
  
      # If Python 2, decode back to unicode (the original input format).
      if six.PY2:
          for line in parsed_csv_lines:
              parsed_csv_line = [
                  six.text_type(col, "utf-8") for col in line
              ]
              break
      else:
          parsed_csv_line = list(parsed_csv_lines)[0]
      return cls.fromlist(parsed_csv_line, fields)
  
file_path: decanlp/text/torchtext/data/example.py
imports: import csv
  import sys
  import json
  import six
label_desc: Use image node_id 4 for calling the Example obj's underlying member method code with example usage: obj.fromCSV(cls, data, fields) and returns: cls