jakevdp / open-recipe-data Goto Github PK
View Code? Open in Web Editor NEWOpen recipe data used by the Python Data Science Handbook
Open recipe data used by the Python Data Science Handbook
Dear all
I am learning from the Data Science Handbook now on Py 3.8/3.9. Just to share some small lines of code/modification that needs to be included to read the json file properly in those Python versions.
a) pg185 In[19] needs importing of StringIO for use with pd.read_json() to avoid "ValueError: Protocol not known":
from io import StringIO
with open("recipeitems.json") as f:
line = f.readline()
pd.read_json(StringIO(line)).shape
b) pg185 In[20] needs specification of encoding="utf8" to avoid a UnicodeDecodeError,
and as above, the use of StringIO() with pd.read_json():
with open("recipeitems.json", 'r', encoding="utf8") as f:
data = (line.strip() for line in f)
data_json = f'[{",".join(data)}]'
recipes = pd.read_json(StringIO(data_json))
recipes.shape
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.