Created
May 16, 2019 12:36
-
-
Save L-Lewis/b9878352e19a734dec08364c037803e8 to your computer and use it in GitHub Desktop.
Creating a set of all possible amenities in the Airbnb dataset
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
amenities_list = list(df.amenities) | |
amenities_list_string = " ".join(amenities_list) | |
amenities_list_string = amenities_list_string.replace('{', '') | |
amenities_list_string = amenities_list_string.replace('}', ',') | |
amenities_list_string = amenities_list_string.replace('"', '') | |
amenities_set = [x.strip() for x in amenities_list_string.split(',')] | |
amenities_set = set(amenities_set) | |
amenities_set |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment