I downloaded the 2015 adverse drug events data from openfda and I want to run some analysis with python. I am a python newbie, but have become comfortable with the scikit-learn libraries, but I cannot seem to get the json decoding to work to even get started.
This is my basic script:
import json
import zipfile
d = None
data = None
with zipfile.ZipFile("./data/drug-event-Q4-0001-of-0013.json.zip", "r") as z:
for filename in z.namelist():
print(filename)
with z.open(filename) as f:
data = f.read()
d = json.loads(data)
I know this is a pretty basic question, but I have been searching and though I am able to find code snippets for gzip, I cannot find any for plain zip files.