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
import geopandas as gpd | |
# Importing the London borough boundary GeoJSON file as a dataframe in geopandas | |
map_df = gpd.read_file('data/neighbourhoods.geojson') | |
# Creating a dataframe of listing counts and median price by borough | |
borough_df = pd.DataFrame(df.groupby('borough').size()) | |
borough_df.rename(columns={0: 'number_of_listings'}, inplace=True) | |
borough_df['median_price'] = df.groupby('borough').price.median().values |
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 |
NewerOlder