Closed mazbeh closed 1 year ago
Hi @mazbeh : Apologies, it looks like there's an error in the documentation. Rather than layout = 'table'
, you should pass the argument orient = 'table'
.
If you take a look at the documentation for the .from_json()
function (see here), you'll find that it only expects:
as_json
- the location of your JSON filetarget
- where you want your SPSS file to gocompress
- a True/False flag as to whether you want the data in ZSAV (compressed) format or standard SAV (uncompressed) formatAll other keyword arguments - like in this case orient
- are passed directly to the pandas.read_json()
function, so you can look at those options in the Pandas documentation here.
I'll fix the SPSS Converter documentation and re-release shortly.
Looking through the API and thinking about it a little more, I realized that it will be more consistent with the .to_*
functions if I explicitly add support for the layout
parameter to .from_json()
and .from_yaml()
. So that's what I will do, and I'll re-release a new version later today. In the meantime, you can feel free to use orient = 'table'` rather than
layout = 'table'`` and it should work fine for you.
I'll re-close this issue when the next version is released.
Okay, I've released v.0.2.0 which addresses this issue. Thanks for bringing it to my attention!
@insightindustry thanks alot for replaying ! that is nice of ! i would try it again and let you know :)))
Hello every body,
my question is maybe very simple but it is problem for me while i have no idea of programming -_- . so any help or tips will be appreciated , thanks ! i have a very simple code that must covert a json file into spss for me :
import spss_converter
as_spss = spss_converter.from_json('/home/user/file.json', target = '/home/user/my-spss-file.sav', layout = 'table')
but if i run the code with : python3 spss.py
i get the following error: TypeError: read_json() got an unexpected keyword argument 'layout'
I run it on Ubuntu ( Python 3.8.10 )
Thanks for your help !