急急急,各位前辈,请问这段代码出了什么问题,总是运行不来,说是day_start day_end

from matplotlib.dates import DateFormatter
from matplotlib.dates import DayLocator
from matplotlib.dates import MonthLocator
from matplotlib.dates import YearLocator
from matplotlib.finance import _quotes_historical_yahoo
from matplotlib.finance import _candlestick
import pandas as pd
from pandas import DataFrame as df
from pandas import Series as sr
import os
import numpy as np
os.chdir("D:\python1")
from datetime import date
import matplotlib.pyplot as plt
day_start = date (2011,11,4)
day_end = date(2011,12,4)
years =YearLocator()
months = MonthLocator()
days = DayLocator()
year_formatter = DateFormatter("%b %Y")
SP = _quotes_historical_yahoo('^GSPC',day_start,day_end)
np.savetxt("SP.txt",SP,delimiter=',',newline='\n')
SSE = _quotes_historical_yahoo('000001.SS',day_start,day_end)
np.savetxt("SSE.txt",SSE,delimiter=',',newline='\n')
fig = plt.figure()
ax = fig.add_subplot(1,1,1)
ax.xaxis.set_major_locator(years)
ax.xaxis.set_minor_locator(months)
ax.xaxis.set_major_formatter(year_formatter)

_candlestick(ax,(SP,SSE))
fig.autofmt_xdate()
plt.show()

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问