-
Notifications
You must be signed in to change notification settings - Fork 18.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
03.10 openrecipes database has no values or object #179
Comments
Hi, So I used: And changed Finally, to correctly read the data, you might need to change the files encoding during open, that is adding # read the entire file into a Python array`
with open('20170107-061401-recipeitems.json', 'r', encoding="utf-8") as f:
# Extract each line
data = (line.strip() for line in f)
# Reformat so each line is the element of a list
data_json = "[{0}]".format(','.join(data))
# read the result as a JSON Maybe this helps! |
@SRSteinkamp thank you for your encoding tip. I was having a problem downloading the latest stable version of the open recipes .json file and your tip corrected the problem. |
FileNotFoundError Traceback (most recent call last) FileNotFoundError: [Errno 2] No such file or directory: '20170107-061401-recipeitems.json' Help |
As of Pandas 1.1, you may need to further adjust the code fragment, as follows:
|
After almost giving up, it seems the simplest solution works (thanks to the information of the 2017 file and related issue fictivekin/openrecipes#218): recipes=pd.read_json('/content/20170107-061401-recipeitems.json.gz',lines=True) |
The instructions in the updated second edition notebook should work: https://github.com/jakevdp/PythonDataScienceHandbook/blob/d66231454ef753818dc9213c9b5942e067266966/notebooks/03.10-Working-With-Strings.ipynb |
I use the colab , here is the shared url
https://colab.research.google.com/drive/15uoHS3S48Q3GQTBrzEpneWiD6MHVnylr
The text was updated successfully, but these errors were encountered: