Skip to content

Specify decimals of numeric variables when using write_sav() #114

Answered by ofajardo
diego-EA asked this question in Q&A
Discussion options

You must be logged in to vote

hmm, this looks correct:

formats = {'g_nps_1': 'F20.13', 'g_nps_2': 'F20.13'}
pyreadstat.write_sav(df_aux_2, os.path.join(data_path, output_file), variable_format=formats)

and the error:

TypeError: write_sav() got an unexpected keyword argument 'variable_format'

suggests that you are using an old version of pyreadstat (the argument is new in version 1.0.7) ... could you please check what version of pyreadstat you are using (print pyreadstat.__version__) and if old please update it

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@diego-EA
Comment options

@ofajardo
Comment options

Answer selected by ofajardo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants