parse_csv
result = parse_csv(str)
Input: str · Output: result
What it is
Converts str (string, CSV text) to a Table — exactly read_csv's own parsing (Table::from_csv, the headers=true, sep=",", decimal="." defaults; use read_csv on a real file for the headers=/sep=/decimal= keyword arguments).
Overloads
One call shape — this function is not overloaded.
| Code | Input | Output | Description |
result = parse_csv(str) | str string or Tablenot documented yet | result Table | Returns a Table. |
Examples
From the documentation, and run by the build -- the output and the figure below are what the engine actually produced. Simplest first.
t = parse_csv("product,price\nWidget,9.99\nGadget,4.50\n")
csv_text = csvify(t)
json_text = jsonify(t)
back_from_json = json2csv(json_text) # csvify(parse_json(json_text))
print(back_from_json)
xml_from_csv = csv2xml(csv_text) # xmlify(parse_csv(csv_text))
csv_from_xml = xml2csv(xml_from_csv) # csvify(parse_xml(xml_from_csv))
print(csv_from_xml)
xml_from_json = json2xml(json_text) # xmlify(parse_json(json_text))
json_from_xml = xml2json(xml_from_json) # the row-object array, not jsonify(parse_xml(...))
parsed = parse_json(json_from_xml) # parse_json accepts that shape too -- back to a real Table
print(nrow(parsed)) # 2
output
product,price Widget,9.99 Gadget,4.5 product,price Widget,9.99 Gadget,4.5 2
from file-io