尘风
红尘往事,一切随风

 
代码:
import csv
from matplotlib import pyplot as plt
arr=[]
arrmin=[]
date=[]
with open(r'C:\Users\Administrator\Desktop\新建文本文档 (3).csv') as cs:
    read=csv.reader(cs)
    header=next(read) #next()函数返回文件的下一行,这里只调用一次就返回第一行,同时因为对read调用了一次next,所以之后的read读取会从第二行开始
    row=0
 
    for i in read:
       
        arr.append(int(i[0])) #提取csv文件里面的第一列数据
        arrmin.append(int(i[1])) #提取csv文件里面的第二列数据
        date.append(int(i[2])) #提取csv文件里面的第三列数据
print(header)  
print(arr)
print(date)
plt.plot(date,arr,c='yellow')
plt.plot(date,arrmin,c='red')
 
plt.show()
   
 
posted on 2020-09-07 23:27  一个行者  阅读(1317)  评论(0编辑  收藏  举报