哪位大神帮忙看看,这是出了什么问题,怎么运行不了,还抛异常!

from matplotlib.finance import quotes_historical_yahoo_ochl
from datetime import date
import pandas as pd
today = date.today()
start = (today.year-2, today.month, today.dat)
quotes = quotes_historical_yahoo_ochl('MSFT', start, today)
attributes = ['date','open','close','high','low','volume']
quotesdf = pd.DataFrame(quotes, columns = attributes)
list1 = []
for i in range(0, len(quotes)):
    x = date.fromordinal(int(quotes[i][0]))
    y = date.strftime(x, '%Y/%m/%d')
list1.append(y)
quotesdf.index = list1
quotesdf = quotesdf.drop(['date'], axis = 1 )
quotesdf.ix['14/01/30':'14/02/10',['open', 'close']]
quotesdf['14/01/01':'15/01/01'].sort('close', ascending=False)[0:5]
list1 = []
tmpdf = quotesdf['15/01/01':'15/12/31']
for i in range(0, len(tmpdf)):
    list1.append(int(tmpdf.index[i][3:5]))
tmpdf['month'] = list1
print tmpdf[ tmpdf.close > tmpdf.open]['month'].value_counts()

http://img.mukewang.com/573824790001e89d06830184.jpg

yuantongxin
浏览 4647回答 2
2回答
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

Python