0

I have .sav file and i need to convert it into csv file.

I tried to use import savReaderWriter library but its not working. I am getting this error:

SPSSIOError: Problem opening file b'C:\\Users\\

I know in R it might be easier but i really need in Python. Any help?

s_khan92
  • 969
  • 8
  • 21
  • Does this answer your question? [Is there a Python module to open SPSS files?](https://stackoverflow.com/questions/14647006/is-there-a-python-module-to-open-spss-files) – Nicolas Gervais Mar 06 '20 at 16:37

1 Answers1

1

Try with pyreadstat:

import pyreadstat

df, meta = pyreadstat.read_sav(r"C:\path\to\file.sav")

df.to_csv("mycsv.csv")

You have to install it with :

pip install pyreadstat

more information here:

https://github.com/Roche/pyreadstat

Otto Fajardo
  • 3,037
  • 1
  • 18
  • 26