python - How are numeric and string variables determined in SPSS? -
so found page explains different types of variables well: http://www.spss-tutorials.com/spss-variable-types-and-formats/
i know though, how numeric , string types differentiated when export data? numeric , string mapped code?
i parse spss data in python.
if take note of print output generated code below, you'll notice string variables "exported" strings (not surprisingly) , numeric variables converted/exported floats.
date variables converted floats, date represented number of seconds have elapsed since october 14, 1582 - manner in spss stores date variables within spss there various formats date variable can set displayed (the float value stored internally of course remains same).
input file variable formats:
input file data view:
code read spss data python , print results:
get file="c:\program files\ibm\spss\statistics\23\samples\english\employee data.sav". begin program. import spss, spssdata allfiles = spssdata.spssdata().fetchall() print "\n".join([str(i) in allfiles]) end program.
output:
namedtuple(1.0, u'm ', 11654150400.0, 15.0, 3.0, 57000.0, 27000.0, 98.0, 144.0, 0.0) namedtuple(2.0, u'm ', 11852956800.0, 16.0, 1.0, 40200.0, 18750.0, 98.0, 36.0, 0.0) namedtuple(3.0, u'f ', 10943337600.0, 12.0, 1.0, 21450.0, 12000.0, 98.0, 381.0, 0.0) namedtuple(4.0, u'f ', 11502518400.0, 8.0, 1.0, 21900.0, 13200.0, 98.0, 190.0, 0.0) namedtuple(5.0, u'm ', 11749363200.0, 15.0, 1.0, 45000.0, 21000.0, 98.0, 138.0, 0.0) namedtuple(6.0, u'm ', 11860819200.0, 15.0, 1.0, 32100.0, 13500.0, 98.0, 67.0, 0.0) namedtuple(7.0, u'm ', 11787552000.0, 15.0, 1.0, 36000.0, 18750.0, 98.0, 114.0, 0.0) namedtuple(8.0, u'f ', 12103948800.0, 12.0, 1.0, 21900.0, 9750.0, 98.0, 0.0, 0.0) namedtuple(9.0, u'f ', 11463897600.0, 15.0, 1.0, 27900.0, 12750.0, 98.0, 115.0, 0.0) namedtuple(10.0, u'f ', 11465712000.0, 12.0, 1.0, 24000.0, 13500.0, 98.0, 244.0, 0.0) namedtuple(11.0, u'f ', 11591424000.0, 16.0, 1.0, 30300.0, 16500.0, 98.0, 143.0, 0.0) namedtuple(12.0, u'm ', 12094012800.0, 8.0, 1.0, 28350.0, 12000.0, 98.0, 26.0, 1.0) namedtuple(13.0, u'm ', 11920867200.0, 15.0, 1.0, 27750.0, 14250.0, 98.0, 34.0, 1.0) namedtuple(14.0, u'f ', 11561529600.0, 15.0, 1.0, 35100.0, 16800.0, 98.0, 137.0, 1.0) namedtuple(15.0, u'm ', 11987654400.0, 12.0, 1.0, 27300.0, 13500.0, 97.0, 66.0, 0.0) ... ...
Comments
Post a Comment