You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When reading an SPSS File, (at least) one of the variables is assigned a different name, than it has in the SPSS file.
I've never noticed that behaviour before, only when struggeling with the known issue #119 with reading long string variables (they are being split into multiple variables there).
Weirdly the variable in this case is a numeric variable with just 0/1 values, so I doubt it is related to the same problem.
A solution I have found for this issue as well as #119 is to open the file in SPSS make any change to it and save it again. Then everything is imported correctly.
import pyreadstat as sav
import re
# load data
data, meta = sav.read_sav(test.sav)
# access variable in question --> this will give an error!
print(data["BRANDAA_SUN_1"])
# instead the variable was renamed while importing into python:
print(data["BRANDAA"])
execute the same code and this time there is no error when accessing column "BRANDAA_SUN_1"
Setup Information:
pyreadstat 1.1.4 was installed with pip (I also tried it with 1.1.2)
a virtual environment created with venv
Python3.8 (plain)
Windows10, 64bit
The text was updated successfully, but these errors were encountered:
I think the file has been created using the IBM spss dll files instead of the full application, but it should be possible to read it correctly since pspp does it correctly. I have submitted a ticket to Readstat, we have to wait for them to fix it.
I have come across a very strange problem today.
When reading an SPSS File, (at least) one of the variables is assigned a different name, than it has in the SPSS file.
I've never noticed that behaviour before, only when struggeling with the known issue #119 with reading long string variables (they are being split into multiple variables there).
Weirdly the variable in this case is a numeric variable with just 0/1 values, so I doubt it is related to the same problem.
A solution I have found for this issue as well as #119 is to open the file in SPSS make any change to it and save it again. Then everything is imported correctly.
Reproducing the issue
Setup Information:
pyreadstat 1.1.4 was installed with pip (I also tried it with 1.1.2)
a virtual environment created with venv
Python3.8 (plain)
Windows10, 64bit
The text was updated successfully, but these errors were encountered: