from jqdata import jy from jqdata import * #获取股票列表,这里是板块内股票 pool=get_industry_stocks('801730',date='2016-09-01') df = get_fundamentals(query(balance.pubDate,balance.total_assets,balance.total_liability, valuation.market_cap,indicator.roe,valuation.pcf_ratio,valuation.pe_ratio_lyr,valuation.pb_ratio, indicator.net_profit_to_total_revenue,indicator.eps,).filter( # 这里不能使用 in 操作, 要使用in_()函数 valuation.code.in_(pool) ),statDate='2016q3') df.index=list(df['pubDate']) #写入txt,无index df.to_csv('fund.txt',sep=' ',index=False) #读txt为DataFrme pd.read_csv('fund.txt',sep=' ',index_col=0)