Skip to content

Instantly share code, notes, and snippets.

@srang992
Created October 15, 2022 16:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save srang992/0848b18144381e4afcb5b30840dade41 to your computer and use it in GitHub Desktop.
Save srang992/0848b18144381e4afcb5b30840dade41 to your computer and use it in GitHub Desktop.
# taking the 'State' and 'Alpha code' column from the scrapped table
df = df[['State', 'Alpha code']]
# renaming the 'State' column of the original data to 'Alpha code'
chain_data.rename(columns={'State': 'Alpha code'}, inplace=True)
# merging the scrapped table with the original data
chain_data = pd.merge(left=chain_data_sort, right=df, left_on='Alpha code', right_on='Alpha code')
# dropping the 'Alpha code' column
chain_data.drop('Alpha code', axis=1, inplace=True)
# taking the necessary columns from the original table
chain_data_sort = chain_data[['RestaurantName', 'Cuisine', 'State', 'CNTY_NAME', 'UA_NAME', 'Frequency']]
# displaying the table
chain_data_sort.head()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment