Read in csv file attachment with integers being wrapped in quotes

Hi. I have read in the file that I have attached to the notebook. My code looks like the following:

d3 = require('d3-dsv')

data = d3.csvParse(
  await FileAttachment("data_file.csv").text(),
  d3.autoType
) 

The data returned:

Object {ParentAccount: "GE Appliances", Amount: 150000}

How do I make Amount value wrapped in double-quotes? Desired output is:

Object {ParentAccount: "GE Appliances", Amount: "150000"}

You can remove the second argument to d3.csvParsed3.autoType is what is parsing the string into an integer.

2 Likes

Perfect! Works. Thank you very much @yurivish