I have written a function to plot data and run a regression from two lists - so far, so good. Now, I'm trying to turn two columns from my CSV file into lists, so that I can run my function on them. Alas, I have not had any luck.
Currently, the best I can do is to get the columns into an array:
which simply looks like this:
Now, however, I can't seem to get these nested lists (I guess that's what they are?) into their own lists so that I can run my function on them. Is there maybe a better way to get these columns into lists?
Also, the CSV file has a header, which I simply excluded with skiprows. It would be particularly neat if the columns were automatically named after those headers. That would, presumably, allow me to simply run my function on, say, ("SIZE","INCOME"), rather than digging up the column numbers for them.
Thoughts and help are much appreciated.
Currently, the best I can do is to get the columns into an array:
Code:
numpy.loadtxt(DATA+"ces.csv", dtype=int, skiprows=1, delimiter=",", unpack=true, usecols=(0,1))
Code:
array([[641702, 641732, 641762, ..., 657902, 657942, 657952],
[ 4, 4, 1, ..., 4, 7, 1]])
Also, the CSV file has a header, which I simply excluded with skiprows. It would be particularly neat if the columns were automatically named after those headers. That would, presumably, allow me to simply run my function on, say, ("SIZE","INCOME"), rather than digging up the column numbers for them.
Thoughts and help are much appreciated.