-
Notifications
You must be signed in to change notification settings - Fork 65
Description
Hi there,
I am trying convert a pd dataframe in to a sav file. Everything works fine (thanx to your package and I'm grateful for that) apart from the dictionary parameters.
I want to save some variables as integers and for them to have missing values as well (NaN)
I know that python does not allow for integers to have NaN values ...but float variables can.
So ...I was thinking of having the variable as float and to remove any decimal points when I convert/save my Dataframe in to a sav file.
[I'm using Spyder in Anaconda 3 (Python 3.7.3) and the package was installed through conda.]
So... I have created a variable_display_width dictionary with my variables and I was adding the dictionary when I was saving the file....but the file created did not use any of the data set in the dictionary.
I have also tried it with the variable_measure which was unknown (I changed it to nominal) but nothing happened again...
On the other hand I tried adding a column_labels list and it worked absolutely fine.
Is there something that I need to change when is save the file or is it the package ?
Here is a small example of my syntax. (Let's say that I have a dataframe named test that has the following two columns : Column 1 , Column 2)
variable_measure = {"Column 1": "nominal","Column 2": "nominal"}
pyreadstat.write_sav(test, 'C:\SPSS\test.sav',variable_measure = variable_measure)
Thank you in advance