Skip to content

Instantly share code, notes, and snippets.

View fk-pixel's full-sized avatar

Kurt F. fk-pixel

View GitHub Profile
@fk-pixel
fk-pixel / x.py
Created August 17, 2020 12:50
Manchester, Greater Manchester, North West England, England, United Kingdom
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"))
@fk-pixel
fk-pixel / y.py
Last active August 17, 2020 13:01
Foursquare Credentials and Version
#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)
@fk-pixel
fk-pixel / z.py
Created August 17, 2020 13:07
What are the top 5 venues/facilities nearby profitable real estate investments?
# 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)
@fk-pixel
fk-pixel / Clusters.py
Last active August 17, 2020 13:12
Distribute in 5 Clusters
#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)
# 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]
@fk-pixel
fk-pixel / special_clustering.py
Created August 17, 2020 13:21
special_clustering
manchester_grouped_clustering.loc[manchester_grouped_clustering['Cluster Labels'] == 0, manchester_grouped_clustering.columns[[1] + list(range(5, manchester_grouped_clustering.shape[1]))]].head()
!pip install --upgrade pip
import folium
map_deutschland = folium.Map(location=[51.133481,10.018343],
zoom_start = 5)
map_deutschland
import json
# word cloud library
from wordcloud import WordCloud
# seaborn
import seaborn as sns
# matplotlib
import matplotlib
# 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()