by Anonymous » 10 Apr 2025, 05:48
Ich möchte mit Pandas an einer SPSS -Dateien (.sav) arbeiten. 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), es scheint, dass die erste Zeile das Etikett s enthält, während die zweite Zeile den Varname s. Pandas also: < /p>
Code: Select all
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 do a head(), the first row (Label) is missing:
How can labels be beibehalten?>
[url=viewtopic.php?t=14917]Ich möchte[/url] mit Pandas an einer SPSS -Dateien (.sav) arbeiten. In the absence of the SPSS program, here's what a typical file looks like when converted to .csv:
[img]https://i.sstatic.net/jkeKV.png[/img]
On investigation into what the first two rows signify (I don't know SPSS), es scheint, dass die erste Zeile das Etikett s enthält, während die zweite Zeile den Varname s. Pandas also: < /p>
[code]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
[/code]
and then do a head(), the first row (Label) is missing:
[img]https://i.sstatic.net/A6JBp.png[/img]
How can labels be beibehalten?>