I'm trying to read a CSV file using numpy.recfromcsv(...)
where some of the fields have commas in them. The fields that have commas in them are surrounded by quotes i.e., "value1, value2"
. Numpy see's the quoted field as two different fields and it doesn't work very well. The command I'm using right now is
data = numpy.recfromcsv(dataFilename, delimiter=',', autstrip=True)
I found this question
But it doesn't use numpy
, which I'd really love to use.
So I'm hoping there are at least one of a few options here:
- What are some options to
numpy.recfromcsv(...)
that will allow me to read a quoted field as one field instead of multiple comma separated fields? - Should I format my CSV file differently?
- (alternatively, but not ideally) Read CSV as in quoted question, with extra steps to create
numpy
array.
Please advise.