DerwenAI / kglab

Graph Data Science: an abstraction layer in Python for building knowledge graphs, integrated with popular graph libraries – atop Pandas, NetworkX, RAPIDS, RDFlib, pySHACL, PyVis, morph-kgc, pslpython, pyarrow, etc.
https://derwen.ai/docs/kgl/
MIT License
574 stars 65 forks source link

Food.com URL Changes #338

Open tommybbq opened 3 months ago

tommybbq commented 3 months ago

I'm submitting a

Current Behaviour:

Food.com has changed the URI for each recipe by moving from straight id to hyphenated name then id, so the tutorial site needs to be changed.

example: old url: https://www.food.com/recipe/164636 new, working url: https://www.food.com/recipe/1-1-1-tempura-batter-164636

It's easy to fix in the notebooks:

create column 'hyphen' that converts spaces to hyphens in the 'name' column

df['hyphen'] = df['name'].str.replace(' ', '-')

create column 'newID' that concatenates 'id' and 'hyphen' columns

df['newID'] = df['hyphen'] + '-' + df['id'].astype(str)

drop id and hyphen columns

df = df.drop(columns=['id', 'hyphen'])

rename newID column to id

df = df.rename(columns={'newID': 'id'})