1200字范文,内容丰富有趣,写作的好帮手!
1200字范文 > 用Python从wind获取数据 转换成dataframe格式 并保存成excel文件

用Python从wind获取数据 转换成dataframe格式 并保存成excel文件

时间:2019-05-31 11:20:44

相关推荐

用Python从wind获取数据 转换成dataframe格式 并保存成excel文件

import openpyxl

from openpyxl.workbook import Workbook

from WindPy import *

from pandas import *

import numpy as np

import pandas as pd

w.start();

data=w.wss(“031390396.IB,031490164.IB”, “sec_name,trade_code,issue_issuemethod,windl2type,issue_firstissue,ipo_cappaydate,rate_ratebond,latestissurercreditrating2,issue_amountplan,issue_issueyear,termnote,issuershortened,industry2,province,agency_leadunderwriter,agency_guarantor,latestratingofguarantor”,“tradeDate=;ratingAgency=101;type=1;unit=1;industryType=1;industryStandard=1”)

data=pd.DataFrame(data.Data,index=data.Fields)

data=data.T #转置

writer = pd.ExcelWriter(‘112.xlsx’)

data.to_excel(writer, sheet_name=‘Data1’, startcol=0, index=False)

writer.save()

本内容不代表本网观点和政治立场,如有侵犯你的权益请联系我们处理。
网友评论
网友评论仅供其表达个人看法,并不表明网站立场。