pandas报错!
代码如下:
import matplotlib.pyplot as plt
import pandas as pd
file_name = 'C:/Users/mufeng/Desktop/20160902(2).csv'
data = pd.read_csv(file_name)
data.columns = ['road-ID','speed','level','Traffic index','time']
print(data)
print(data.shape)
time = data['time']
speed = data['speed']
Traffic_index=data['Traffic index']
#速度时间散点图
plt.scatter(time,speed,s = 40,color = 'w',marker='o',edgecolor='r',alpha=0.5)
plt.xlabel('Time',fontdict={'family':'SimHei','color':'black','size':15})
plt.ylabel('Speed',fontdict= {'family':'SimHel','color':'black','size':15})
plt.title('速度-时间',fontdict = {'family':'SimHel','color':'black','size':24})
plt.show()
#速度分布直方图
a=[]
a=list(range(0,115,5))
plt.title('速度分布',fontdict={'family':'SimHei','color':'black','size':24})
plt.hist(speed,a,rwidth=0.9)
plt.xlabel('Speed',fontdict={'family':'SimHel','color':'black','size':15})
plt.ylabel('Amount',fontdict={'family':'SimHel','color':'black','size':15})
plt.show()
#交通拥堵指数折线图
plt.title('交通拥堵指数',fondict={'family':'SimHel','color':'black','size':24})
plt.plot(time,Traffic_index,c='b')
plt.scatter(time,Traffic_index,c='black',s=10)
plt.xlabel('Time',fontdict={'family':'SimHel','color':'black','size':15})
plt.ylabel('Traffic index',fontdict={'family':'SimHel','color':'black','size':15})
plt.show()
想知道问题出在哪里了怎么改正