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
from functools import partial | |
from geopy.geocoders import Nominatim | |
geolocator = Nominatim(user_agent="manchester_value") | |
geocode = partial(geolocator.geocode, language="en") | |
from geopy.geocoders import Nominatim | |
print(geocode("manchester")) |
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
#Define Foursquare Credentials and Version | |
CLIENT_ID = 'Your client id' # Foursquare ID | |
CLIENT_SECRET = 'Your client secret' # Foursquare Secret | |
VERSION = '20181206' # Foursquare API version | |
print('Your credentails:') | |
print('CLIENT_ID: ' + CLIENT_ID) | |
print('CLIENT_SECRET:' + CLIENT_SECRET) |
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
# What are the top 5 venues/facilities nearby profitable real estate investments?# | |
num_top_venues = 5 | |
for hood in manchester_grouped['Street']: | |
print("----"+hood+"----") | |
temp = manchester_grouped[manchester_grouped['Street'] == hood].T.reset_index() | |
temp.columns = ['venue','freq'] | |
temp = temp.iloc[1:] | |
temp['freq'] = temp['freq'].astype(float) |
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
#Distribute in 5 Clusters | |
# set number of clusters | |
kclusters = 5 | |
manchester_grouped_clustering = manchester_grouped.drop('Street', 1) | |
# run k-means clustering | |
kmeans = KMeans(n_clusters=kclusters, random_state=0).fit(manchester_grouped_clustering) |
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
# Create Map | |
map_clusters = folium.Map(location=[latitude, longitude], zoom_start=11) | |
# set color scheme for the clusters | |
x = np.arange(kclusters) | |
ys = [i+x+(i*x)**2 for i in range(kclusters)] | |
colors_array = cm.rainbow(np.linspace(0, 1, len(ys))) | |
rainbow = [colors.rgb2hex(i) for i in colors_array] |
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
manchester_grouped_clustering.loc[manchester_grouped_clustering['Cluster Labels'] == 0, manchester_grouped_clustering.columns[[1] + list(range(5, manchester_grouped_clustering.shape[1]))]].head() |
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
!pip install --upgrade pip |
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 folium | |
map_deutschland = folium.Map(location=[51.133481,10.018343], | |
zoom_start = 5) | |
map_deutschland |
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 json | |
# word cloud library | |
from wordcloud import WordCloud | |
# seaborn | |
import seaborn as sns | |
# matplotlib | |
import matplotlib |
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
# Plotting a bar graph of the number of stores in each city, for the first ten cities listed# in the column 'City' | |
city_count = sbucks_de['City'].value_counts() | |
city_count = city_count[:10,] | |
plt.figure(figsize=(10,5)) | |
sns.barplot(city_count.index, city_count.values, alpha=0.8) | |
plt.title('Starbucks TOP 10 City in DE') | |
plt.ylabel('Values', fontsize=12) | |
plt.xlabel('City', fontsize=12) | |
plt.show() |
OlderNewer