3

New to scipy but not to python. Trying to import a .sav file to scipy so I can do some basic work on it. But, each time I try to import the file using scipy.io.readsav(), python throws an error:

Traceback (most recent call last):

  File "<ipython-input-7-743be643d8a1>", line 1, in <module>
    dataset = io.readsav("c:/users/me/desktop/survey.sav")

  File "C:\Users\me\Anaconda3\lib\site-packages\scipy\io\idl.py", line 726, in readsav
    raise Exception("Invalid SIGNATURE: %s" % signature)

Exception: Invalid SIGNATURE: b'$F'

Any idea what's happening? I can open the file in R and manipulate the data, but I'd like to do it in Python. Running Anaconda on Windows.

Peppa Jack
  • 55
  • 1
  • 4

2 Answers2

4

scipy.io.readsav() reads IDL SAVE files. You have tagged this question spss, so I assume you are trying to read an SPSS file. The format of an SPSS .sav file is not the same as the format of an IDL SAVE file.

Warren Weckesser
  • 110,654
  • 19
  • 194
  • 214
0

Look on pypi for savReaderWriter for Python code to read and write sav files.

JKP
  • 5,419
  • 13
  • 5