我想在Python中将*.sav文件的内容转换为*.csv文件。我编写了以下代码行来访问 *.sav 文件中变量的详细信息。现在,我不清楚如何将访问的变量数据写入带有标题的 .csv 文件
import scipy.io as spio
on2file = 'ON2_2015_112m_220415.sav'
on2data = spio.readsav(on2file, python_dict=True, verbose=True)
Run Code Online (Sandbox Code Playgroud)
以下是我运行上述代码行时的结果:
IDL Save file is compressed
-> expanding to /var/folders/z4/r3844ql123jgkq1ztdr4jxrm0000gn/T/tmpVE_Iz6.sav
--------------------------------------------------
Date: Mon Feb 15 20:41:02 2016
User: zhangy1
Host: augur
--------------------------------------------------
Format: 9
Architecture: x86_64
Operating System: linux
IDL Version: 7.0
--------------------------------------------------
Successfully read 11 records of which:
- 7 are of type VARIABLE
- 1 are of type TIMESTAMP
- 1 are of type NOTICE
- 1 are of type VERSION …Run Code Online (Sandbox Code Playgroud)