I am trying to generate SPSS and Stata files using CSV files + JSON metadata as input as described here. However, in the generated files, every numeric variable has decimals, so 1, 2, 3 become 1.0, 2.0, 3.0.
Steps to reproduce:
inputdata.csv:
"var_a","var_b"
1,1.1
2,2.2
3,3.3
meta.json:
{
"type": "SPSS",
"variables": [
{
"type": "NUMERIC",
"name": "var_a",
"decimals": 0
},
{
"type": "NUMERIC",
"name": "var_b",
"decimals": 2
}
]
}
cmd:
readstat inputdata.csv meta.json outputdata.sav
To test, check in SPSS or with pyreadstat:
python -c "import pyreadstat; print(pyreadstat.read_sav('outputdata.sav')[1].original_variable_types)"
My output:
{'var_a': 'F8.2', 'var_b': 'F8.2'}
var_a should be F8.0.
I've poked around with git bisect, and it seems this is a regression introduced in 93036b0. When I checked out the repo from one commit earlier (1b64538) and reran with the same input I got
{'var_a': 'F8.0', 'var_b': 'F8.2'}
Very grateful for any assistance with generating files without all those .0 decimals.
I am trying to generate SPSS and Stata files using CSV files + JSON metadata as input as described here. However, in the generated files, every numeric variable has decimals, so 1, 2, 3 become 1.0, 2.0, 3.0.
Steps to reproduce:
inputdata.csv:meta.json:{ "type": "SPSS", "variables": [ { "type": "NUMERIC", "name": "var_a", "decimals": 0 }, { "type": "NUMERIC", "name": "var_b", "decimals": 2 } ] }cmd:
readstat inputdata.csv meta.json outputdata.savTo test, check in SPSS or with pyreadstat:
python -c "import pyreadstat; print(pyreadstat.read_sav('outputdata.sav')[1].original_variable_types)"My output:
{'var_a': 'F8.2', 'var_b': 'F8.2'}var_ashould be F8.0.I've poked around with git bisect, and it seems this is a regression introduced in 93036b0. When I checked out the repo from one commit earlier (1b64538) and reran with the same input I got
{'var_a': 'F8.0', 'var_b': 'F8.2'}Very grateful for any assistance with generating files without all those
.0decimals.