PythonDataScienceHandbook icon indicating copy to clipboard operation
PythonDataScienceHandbook copied to clipboard

Recipe Database returns empty file

Open musicus opened this issue 7 years ago • 5 comments

On the Vectorized String Operations page the downloaded .json recipe book is empty.

musicus avatar Feb 24 '17 18:02 musicus

Well, I was wondering when that might happen, since I don't control the source. It was sooner than I expected.

jakevdp avatar Feb 24 '17 21:02 jakevdp

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

j-bennet avatar Jul 24 '17 23:07 j-bennet

you can download here https://github.com/sameergarg/scala-elasticsearch/raw/master/conf/recipeitems-latest.json-full.zip

mertyesiltepe avatar Sep 14 '20 20:09 mertyesiltepe

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))

JamesCHub avatar May 04 '21 17:05 JamesCHub

Hi @JamesCHub, Thanks for the guidance. A layman's question: why is StringIO needed?

Huanle avatar Feb 27 '22 08:02 Huanle