tushare为什么获取舆论会报错
ts.get_latest_news(show_content=True),然后返回list index out of range
import tushare as tsimport timewhile True:df = ts.get_realtime_quotes('000581') #Single stock symbolprint df[['code','name','price','bid','ask','volume','amount','time']]time.sleep(2)根据 http://tushare.org/trading.html#id6 提供的例子,你可以包装成函数,传入你要获取的股票代码,df包含30个列的内容,你可以输出你想要的列,也可以保存到数据库里。tushare.org上都写得很清楚了。遍历读取无非就是import tushare as tsdf = ts.get_tick_data('600848',date='2014-01-09')for i in df.index:print df.loc[i]print df.loc[i]['price']其中i就是序号,以i为基础你可以获取所有row的数据,包括具体某一行某一列。python根据坐标读取数据有多重方法,你学明白python后,tushare用起来就方便了。
热门标签: