Exporting to SPSS files in Python Django?

北慕城南 提交于 2019-12-02 06:50:42

问题


i need to export data to SPSS file format in Python (Django), but i can't find util information in google.

Is there some way to do this? Someone has tried?

thanks in advance!


回答1:


The savReaderWriter package can be used to read or write SPSS files (.sav, zsav), including metadata: https://pypi.python.org/pypi/savReaderWriter/3.1.2




回答2:


As far as I am aware, the only API provided by IBM to interact with SPSS is designed to be used in C/C++.

You will have to look up the appropriate SPSS developer's guide for your version of SPSS and download the required files from their website.

That being said, I know you can load a DLL and use it from within Python with ctypes (See this question).

Once you have the API, you can easily read/write/create SPSS database files. I am not sure there are any Django plugins that provide this functionality, but you might be able to write your own. Additionally using ctypes somewhere in your view directly might be a quicker way to do it.

Also, I know later versions of SPSS have Python scripting support but I don't think that could come in handy at all.

EDIT

Here is a list of resources that might be useful for different versions of SPSS:

it turns out all versions after 14.0 use the same API, so I fixed the links to reflect that. Apparently they host a different copy of the file with each version.

  • Developer's Guide (Pdf)
  • Headers, DLL & Docs (Zip)


来源:https://stackoverflow.com/questions/6463763/exporting-to-spss-files-in-python-django

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!