1

Is there a way to read a SPSS (.sav) file into a data-frame without downloading a 3rd party library (I then need to save it as a Stata (.dta) file?

I have looked up and tried:

import from rpy2.robjects import pandas2ri, r

filename = 'small test data.sav'
w = r('foreign::read.spss("%s", to.data.frame=TRUE)' % filename)
df = pandas2ri.ri2py(w)
df.head()

but I get a ImportError: DLL load failed: The specified procedure could not be found as I don't have the library.

halfer
  • 19,824
  • 17
  • 99
  • 186
Stacey
  • 4,825
  • 17
  • 58
  • 99
  • 3
    I hear there is a [savReaderWriter][1] but that you would have to install. Have you tried saving your dataset as a .csv file and then processing it with Python? [1]: https://pythonhosted.org/savReaderWriter/index.html – ragamuffin Nov 05 '18 at 13:40
  • 1
    Possible duplicate of [Is there a Python module to open SPSS files?](https://stackoverflow.com/questions/14647006/is-there-a-python-module-to-open-spss-files) – Mr. T Nov 05 '18 at 15:29

0 Answers0