logoalt Hacker News

RodgerTheGreattoday at 1:53 AM1 replyview on HN

You have to make the decision somewhere in your code, unless you're willing to lean on a heuristic; all of the examples in R and Lil make assumptions about the names of columns in the file on-disk just as they make assumptions about the delimiter and the presence of headers.

If I knew the CSV file didn't have built-in headers, I'd write the Lil script like this:

    purchases:readcsv["country,amount,discount\n",read["headerless.csv"] "sii"]

Replies

lokedhstoday at 2:45 AM

Thanks, that makes sense. I guess most CSV data you see in the real world do have headers. Perhaps I was looking too much about thr default CSV export format from Excel, focusing on making sure it can always be parsed. And Excel doesn't have column headers.