pyjstat icon indicating copy to clipboard operation
pyjstat copied to clipboard

Try to query

Open soyjuanmedina opened this issue 7 years ago • 1 comments

I have this code, but I have a Keyerror... maybe is about dimension is into dataset, but really I don't know

`from pyjstat import pyjstat

EXAMPLE_URL = 'http://www.cso.ie/StatbankServices/StatbankServices.svc/jsonservice/responseinstance/ASJA4'

read from json-stat

dataset = pyjstat.Dataset.read(EXAMPLE_URL)

write to dataframe

df = dataset.write('dataframe') print(df)

read from dataframe

dataset_from_df = pyjstat.Dataset.read(df)

write to json-stat

print(dataset_from_df.write())

query = [{'Age of Farm Holder': 'Under 35 Years'}, {'Year': '1998'}, {'Statistic': 'ASJAC7'}]

dataset = pyjstat.Dataset.read(EXAMPLE_URL) print(dataset.get_value(query))`

soyjuanmedina avatar Apr 26 '17 11:04 soyjuanmedina

hi @soyjuanmedina

I think I know which the problem is. This is not a JSON-stat 2.0 compliant dataset, but a 1.X one. Obviously, I hadn't have the get_value by query method tested for 1.X. I'd like to make some tests and fix it in the best way I can imagine (probably, adding a new parameter to this method with the name of the dataset key and a default value 'dataset').

Give me some time. Thanks for reporting it and for your patience! Sorry for the inconvenience.

predicador37 avatar May 04 '17 22:05 predicador37