Option 1 As Rkbarni pointed out, there is a Python savReaderWriter available through pypi. I ran into two problems:
- It relies on many additional libraries outside the seemingly clean python implementation. SPSS files are read and written in almost every case using IBM SPSS I / O modules. These modules differ in platform, and in my experience "pip install savReaderWriter" prevents them from working out of the box (on OS X).
- The development of savReaderWriter, although not dead, is less relevant than one would hope. This complicates the first release. It uses some outdated packages to increase speed and gives some warnings at any time when you import savReaderWriter, if they are not available. This is not a problem today, but it may be a problem in the future, as IBM continues to update SPSS I / O modules to work with the new SPSS formats (they are already on version 21 or 22 if memory is used).
Option 2 I decided to use R as an average person. Using rpy2, I installed a simple function to read a file into an R-frame of data and output it again as a CSV file, which I subsequently import into python. This is a bit of rube-goldberg, but it works. Of course, this requires R, which can also be a problem to install in your environment (and has different binaries for different platforms).
mgojohn
source share