Sven Schreiber schrieb: > Hi Vincent, of course it depends a little on how exactly your csv file > looks like, but if you just have column headers and the actual data, you > might try something like the following: >
Ok sorry the previous thing doesn't work, I also stumbled over the strings. Here's the next attempt, also shorter. (this time even tested ;-) import csv from numpy import mat read_from = csv.reader(file(filename, 'r'), skipinitialspace = True) stringlist = [ line for line in read_from ] varnames = stringlist.pop(0)[1:] datalist = [ map(float, line[1:]) for line in stringlist ] # now the real data data = mat(datalist, dtype = float) I actually quite like it... python lists are very nice. This discards the observation labels, but it's not difficult to add that, of course. -sven _______________________________________________ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion