Created
October 15, 2022 16:12
-
-
Save srang992/0848b18144381e4afcb5b30840dade41 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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