努力使用netbeans在Python中启动我的第一个程序

时间:2015-08-27 15:42:35

标签: python netbeans plot

我正在尝试使用NetBeans在python中运行我的第一个主程序。但没有任何反应。

import numpy
import datetime
import matplotlib.pyplot as plt
from matplotlib.finance import quotes_historical_yahoo
from matplotlib.dates import MonthLocator,DateFormatter
ticker = 'AAPL'
begdate = datetime.date(2012, 1, 2)
enddate = datetime.date.today()
month = MonthLocator(range(1,13),bymonthday=1, interval=1)
monthFmt = DateFormatter("%b '%Y")
x = quotes_historical_yahoo(ticker,begdate,enddate)
if len(x) == 0:
    print ('SIAF35 - Found No Quote')
    raise SystemExit
dates = [q[0] for q in x]
closes = [q[4] for q in x]
fig, ax = plt.subplots()
ax.plot_date(dates, closes, '_')
ax.xaxis.set_major_locator(month)
ax.xaxis.set_major_formatter(monthFmt)
ax.autoscale_view()
ax.grid(True)
fig.autofmt_xdate()
fig.show()

以上是我尝试使用的代码。我在IDLE中使用它并且它有效,但我想在Netbeans中使用它,所以我可以根据需要修改它。请帮助。

0 个答案:

没有答案