0

I'm trying to read in a .csv file that looks like this:

Name,N1,N2,N3,N4, ...
A,2,1,50,5, ...
B,5,2,-90,7, ...
C,7,3,0.4,9, ...
...

where columns are more than 500 column.

I want to read every row into a pair Vector consisting of:
1- Name
2- Vector containing the rest of the columns (N1..Nn)

It would look something like this vector<pair<string, vector<double>>> but I'm not sure how to read the data into this format.

thank you

Dipie
  • 25
  • 3
  • 1
    Google might be helpful here: I found this in 10 seconds: https://stackoverflow.com/questions/1120140/how-can-i-read-and-parse-csv-files-in-c – Jabberwocky Apr 28 '21 at 09:28
  • @Jabberwocky This wasn't really helpful in my case, I'm not trying to read the row into a one vector. I want to have a pair vector containing the first column to be the first pair, and the rest of the columns are read into another vector to be the second pair. – Dipie Apr 28 '21 at 09:33
  • I didn't close the question as duplicate, but the duplicate will definitely help you for your code. – Jabberwocky Apr 28 '21 at 09:35

0 Answers0