Skip to content

Instantly share code, notes, and snippets.

@amankharwal

amankharwal/hotel.py Secret

Created Feb 13, 2021
Embed
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])
print(data.countries.unique())
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment