How to preserve Labels when SPSS file (.sav) imported into pandas via rpy?
问题 I'm looking to work on a SPSS files (.sav) using pandas . In the absence of the SPSS program, here's what a typical file looks like when converted to .csv: On investigation into what the first two rows signify (I don't know SPSS), it seems that the first row contains the Label s, while the second row contains the VarName s. When I bring the file into pandas thus: import pandas.rpy.common as com def savtocsv(filename): w = com.robj.r('foreign::read.spss("%s", to.data.frame=TRUE)' % filename) w