开发者

error in matplotlib library in python while using csv2rec

开发者 https://www.devze.com 2023-04-08 13:06 出处:网络
I am working in Ipython, trying to开发者_运维技巧 load a csv file. from matplotlib import * data=matplotlib.mlab.csv2rec(\'helix.csv\',delimiter=\'\\t\')

I am working in Ipython, trying to开发者_运维技巧 load a csv file.

from matplotlib import *
data=matplotlib.mlab.csv2rec('helix.csv',delimiter='\t')

Here is the error message

IOError                                   Traceback (most recent call last)
/mnt/hgfs/docs/python/<ipython console> in <module>()
/usr/lib/pymodules/python2.7/matplotlib/mlab.pyc in csv2rec(fname, comments, skiprows, checkrows, delimiter, converterd, names, missing, missingd, use_mrecords)
   2125 
   2126     # reset the reader and start over
-> 2127     fh.seek(0)
   2128     reader = csv.reader(fh, delimiter=delimiter)
   2129     process_skiprows(reader)      
IOError: [Errno 29] Illegal seek

Does someone already run on this error? I tried to re-install everything, I am working with Python2.7 and I have Matplotlib v0.99.3, Numpy v1.5.1, Ipython0.10.1


I tried with this file:

snp1,snp2,snp3
A,A,A
A,B,A
B,B,B

and here is the result:

In [3]: csv2rec('helix.csv')
Out[3]: 
rec.array([('A', 'A', 'A'), ('A', 'B', 'A'), ('B', 'B', 'B')], 
      dtype=[('snp1', '|S1'), ('snp2', '|S1'), ('snp3', '|S1')])

I have matplotlib 1.0.1, so you might try updating it, I do not have access to older matplotlib for testing.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号