-
Notifications
You must be signed in to change notification settings - Fork 69
Open
Labels
bugSomething isn't workingSomething isn't workingrequires changes in Readstatwaiting for changes in the C library Readstatwaiting for changes in the C library Readstat
Description
Hi, not sure how to tell if this is an issue in the c library or pyreadstat. Apologies if it is the former.
As the title says, the "Values" column becomes "None" for a String variable in SPSS if any value is longer than 8 characters.
To reproduce:
import pandas as pd
import pyreadstat
var_values = {'mycol':{'-111':'err1'}}
# I thought setting var_format might have an effect but it seems it does not
# just leaving this here in case you want to compare
var_format = {} # {'mycol':'A50'}
pyreadstat.write_sav(df=pd.DataFrame({'mycol':['-111', '123456789']}), # 2nd value is 9 chars
dst_path='var_values_is_none.sav',
variable_value_labels=var_values,
variable_format=var_format)
pyreadstat.write_sav(df=pd.DataFrame({'mycol':['-111', '12345678']}), # 2nd value is 8 chars
dst_path='var_values_is_NOT_none.sav',
variable_value_labels=var_values,
variable_format=var_format)
Relevant versions:
python 3.12.3
pyreadstat 1.2.7
pandas 2.2.2
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingrequires changes in Readstatwaiting for changes in the C library Readstatwaiting for changes in the C library Readstat