Skip to content

Instantly share code, notes, and snippets.

@srang992
Created April 12, 2023 15:13
Show Gist options
  • Save srang992/d1d1ba99f1250c5b6322b5cc156c2e45 to your computer and use it in GitHub Desktop.
Save srang992/d1d1ba99f1250c5b6322b5cc156c2e45 to your computer and use it in GitHub Desktop.
# defining a dictionary for renaming the columns
column_names = {"ref": "reference_no",
"Company (Manufacturer)": "manufacturer",
"Company Location": "company_loc",
"Review Date": "review_date",
"Country of Bean Origin": "bean_origin",
"Specific Bean Origin or Bar Name": "bar_name",
"Cocoa Percent": "cocoa_percent",
"Ingredients": "ingredients",
"Most Memorable Characteristics": "taste",
"Rating": "rating"}
# renaming the columns and displaying the first 5 rows of the data
choco_data.rename(columns=column_names, inplace=True)
choco_data.head()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment