以日期为x轴的Python脚本
我犯了很多错误。有人在代码中看到像thorn一样突出的东西吗以日期为x轴的Python脚本,python,date,plot,scripting,Python,Date,Plot,Scripting,我犯了很多错误。有人在代码中看到像thorn一样突出的东西吗 from pylab import plot, show, title, xlabel, ylabel, legend import matplotlib.dates as dates title('AF16 compared to AF17') xlabel('Month') ylabel('Donation Amount') legend([af16y, af17y]) af16x = dates.datestr2num[1/1/
from pylab import plot, show, title, xlabel, ylabel, legend
import matplotlib.dates as dates
title('AF16 compared to AF17')
xlabel('Month')
ylabel('Donation Amount')
legend([af16y, af17y])
af16x = dates.datestr2num[1/1/15,3/5/16]
af17x = dates.datestr2num[4/5/16, 2/2/17]
af16y = [3000,5000]
af17y = [350,7000]
plot(af16x,af16y,af17x,af17y)
大多数情况下,我知道图例和日期会导致错误。这是一个schmorgasborg的代码,所以我知道我遇到了错误。非常感谢您的帮助。您遇到了什么错误?datestr2num是一个函数,它接受日期的字符串表示列表。看一看,我得到了一个关于图例的错误:NameError:name'af16y'没有定义我只是注释掉图例,然后我得到了这个错误:af16x=dates.datestr2num[1/1/15,3/15/16]TypeError:'function'对象不是subscriptableanyone正在寻求关于这个概念的帮助,请转到这里: