gpt4 book ai didi

python - 使用 csv2rec 时 python 中的 matplotlib 库出错

转载 作者:太空宇宙 更新时间:2023-11-03 19:27:33 24 4
gpt4 key购买 nike

我正在 Ipython 中工作,尝试加载 csv 文件。

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

这是错误消息

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

有人已经遇到这个错误了吗?我尝试重新安装所有内容,我正在使用 Python2.7,并且有 Matplotlib v0.99.3、Numpy v1.5.1、Ipython0.10.1

最佳答案

我尝试使用此文件:

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

这是结果:

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')])

我有 matplotlib 1.0.1,所以你可以尝试更新它,我无法访问较旧的 matplotlib 进行测试。

关于python - 使用 csv2rec 时 python 中的 matplotlib 库出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7532270/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com