Sorry, I got it wrong and ignored the StringIO part. Lluis
Lluís writes: > Damien Moore writes: [...] >> import numpy, StringIO >> s=StringIO.StringIO('q1,2\nq3,4') >> a=numpy.genfromtxt(s,delimiter=',',converters={0:lambda s:float(s[1:])}) >> s=StringIO.StringIO('q1,2\nq3,4') >> b=numpy.genfromtxt(s,delimiter=',') >> a.shape >> (2,) >> b.shape >> (2,2) >>>>> a >> array([(1.0, 2.0), (3.0, 4.0)], >> dtype=[('f0', '|O4'), ('f1', '<f8')]) >>>>> b >> array([[ NaN, 2.], >> [ NaN, 4.]]) > I think this is what you want: >>>> cat /tmp/test.csv > 1, 2 > 3, 4 >>>> numpy.genfromtxt("/tmp/test.csv", delimiter=",", dtype=float) > array([[ 1., 2.], > [ 3., 4.]]) > Lluis -- "And it's much the same thing with knowledge, for whenever you learn something new, the whole world becomes that much richer." -- The Princess of Pure Reason, as told by Norton Juster in The Phantom Tollbooth _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion