万得转换dataframe
时间: 2023-10-31 19:56:25 浏览: 107
万得数据转换成DataFrame可以使用两种方法,取决于数据是时间序列还是非时间序列数据。
对于非时间序列数据的转换,可以使用以下代码:
```python
def createcleandata(wind_data):
class result(object):
pass
result.Codes = wind_data.Codes
result.Fields = wind_data.Fields
result.Times = wind_data.Times
result.Data = winddatatodataframe(wind_data)
return result
def winddatatodataframe(wind_data):
return pd.DataFrame(wind_data.Data, columns=wind_data.Codes, index=wind_data.Fields).T
```
这个方法使用`wind_data.Data`作为数据,`wind_data.Codes`作为列名,`wind_data.Fields`作为行名进行转换。<span class="em">1</span><span class="em">2</span><span class="em">3</span>
#### 引用[.reference_title]
- *1* [WINDAPI读取期货交易数据](https://blog.csdn.net/CrazyU/article/details/124961694)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
- *2* *3* [Wind万得PythonAPI量化接口常用小工具——时序数据处理及工作日前推查询](https://blog.csdn.net/weixin_44566452/article/details/122424317)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"]
[ .reference_list ]
阅读全文