PythonDataScienceHandbook
PythonDataScienceHandbook copied to clipboard
Recipe Database returns empty file
On the Vectorized String Operations page the downloaded .json
recipe book is empty.
Well, I was wondering when that might happen, since I don't control the source. It was sooner than I expected.
See this issue in the original data repo: https://github.com/fictivekin/openrecipes/issues/218.
To reiterate what was said there, automated backups broke and the developer has no time / resources to fix it, but there's still a database dump available at this URL:
https://s3.amazonaws.com/openrecipes/20170107-061401-recipeitems.json.gz
you can download here https://github.com/sameergarg/scala-elasticsearch/raw/master/conf/recipeitems-latest.json-full.zip
as of May 2021, this is working: !curl -O https://s3.amazonaws.com/openrecipes/20170107-061401-recipeitems.json.gz
!gunzip 20170107-061401-recipeitems.json.gz
And if your Pandas is at v 1.1 or later, you probably need to load it like this:
from io import StringIO
with open('20170107-061401-recipeitems.json', 'r', encoding="utf-8") as f:
data = (line.strip() for line in f)
data_json = "[{0}]".format(','.join(data))
recipesDF = pd.read_json(StringIO(data_json))
Hi @JamesCHub, Thanks for the guidance. A layman's question: why is StringIO needed?