I am looking to work with SPSS files (.sav) using pandas . In the absence of the SPSS program, here is what a typical file looks like when converting to .csv:

When examining what the first two lines mean (I don't know SPSS), it seems that the first line contains Label s and the second line contains VarName s.

When I list the file in pandas this way:
import pandas.rpy.common as com def savtocsv(filename): w = com.robj.r('foreign::read.spss("%s", to.data.frame=TRUE)' % filename) w = com.convert_robj(w) return w
and then run the head () command, the first line (Label) is missing:

How can I save tags?
- Link: Is there a Python module for opening SPSS files?
- Python: 2.7.10
- Pandas: 0.17.1
python pandas r rpy2 spss
Pyderman
source share