我试图从csv文件中绘制红外光谱,如下所示:
import matplotlib.pyplot as plt
file=open('261.1_2014-12-10t16-33-55.csv')
for line in file :
data.append(line)
pointset=data[6:]
for point in pointset:
res=point.split(',')
h=float(res[0])
wn.append(h)
y=float(res[1])
Ads.append(y)
plt.plot(wn,Ads)
plt.show()
但是我得到的不是一条线,而是很多。 变量Ads和wn比点集和数据有更多的条目。 怎么了?你知道吗
您在文件中的行上迭代了两次。对于文件中的每一行,您迭代pointset中的每一点,但pointset只是迄今为止读取的除前六行之外的所有行的集合。你知道吗
我想这就是你想要的:
相关问题 更多 >
编程相关推荐