Skip to content

Instantly share code, notes, and snippets.


amankharwal/ Secret

Created Feb 13, 2021
What would you like to do?
# Replacing "United Kingdom with "UK"
data.Hotel_Address = data.Hotel_Address.str.replace("United Kingdom", "UK")
# Now I will split the address and pick the last word in the address to identify the country
data["countries"] = data.Hotel_Address.apply(lambda x: x.split(' ')[-1])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment