Choosing the Hospital that is the best choice for Medical-Staff relocates a workplace
This project is starting in period COVID-19 pandemic began spreading in Thailand. I have an idea to try to get data from the open-source to find the hospital is the best place to work for the medical staff in a heavy situation like now. For consideration, I focus on three big cities and use criteria of the nearby place include Train station for travel from other city and Cafe for staff leisure time.
import pandas as pd
url = 'https://data.opendevelopmentmekong.net/dataset/ab20b509-2b7f-442e-8448-05d3a17651ac/resource/719e0ba4-637a-46c5-9ad7-9bc0e4c3752d/download/health_facilities_en.csv'
df_Origin = pd.read_csv(url)
df_Origin.head()
ID | Ministry | Department | Agency | Lat | Long | Address | |
---|---|---|---|---|---|---|---|
0 | 1.110000e+11 | Ministry of Defence | Naval Medical Department | Royal Thai Army Phramongkutklao Hospital | 13.76733 | 100.5342 | Thung Phaya Thai Subdistrict, Ratchathewi Dist... |
1 | 1.110000e+11 | Ministry of Justice | Department of Corrections | Department of Corrections Correctional Institu... | 13.85018 | 100.5531 | Ladyao Subdistrict, Chatuchak District, Bangko... |
2 | 1.110000e+11 | Royal Thai Police | Police Hospial | Police Hospital | 13.74414 | 100.5391 | Pathumwan, Pathumwan, Bangkok 10330 |
3 | 1.130000e+11 | Ministry of Defence | Naval Medical Department | Royal Thai Army Ananda Mahidol Hospital | 14.84966 | 100.6670 | Khao Sam Yot Subdistrict, Mueang Lopburi Distr... |
4 | 1.130000e+11 | Ministry of Public Health | Department of Mental Health | Department of Mental Health, Srithanya Hospital | 13.84513 | 100.5171 | Talat Khwan Subdistrict, Mueang Nonthaburi Dis... |
Cities: Khon Kaen, Chiang Mai and Chonburi.
df_3_town =df_Origin[df_Origin['Address'].str.contains('Khon Kaen|Chiang Mai|Chonburi',case=False, regex=True)]
df_3_town.head()
ID | Ministry | Department | Agency | Lat | Long | Address | |
---|---|---|---|---|---|---|---|
10 | 1.140000e+11 | Ministry of Public Health | Department of Medical Services | Department of Medicine, Neurological Hospital,... | 18.78978 | 98.96952 | Number 2, Suthep Road, Suthep Subdistrict, Mue... |
11 | 1.140000e+11 | Ministry of Public Health | Department of Mental Health | Department of Mental Health, Suan Prung Hospital | 18.78074 | 98.97915 | Hai Ya Subdistrict, Mueang Chiang Mai District... |
18 | 1.140000e+11 | Ministry of Public Health | Department of Mental Health | Department of Mental Health, Khon Kaen Rajanag... | 16.42467 | 102.84870 | 169 Soi Kalaya, Chataphadung Road, Nai Mueang ... |
41 | 8.900000e+12 | Ministry of Public Health | Office of the Permanent Secretary, Ministry of... | Mae Ai Hospital Chiang Mai Province | 20.03843 | 99.30260 | 191 Moo 8, Fang-Thaton Road, Moo 8, Mae Ai Sub... |
87 | 8.900000e+12 | Ministry of Public Health | Office of the Permanent Secretary, Ministry of... | Banglamung Hospital Chonburi Province | 12.96664 | 100.90620 | No. 6 Moo 5, Naklua Subdistrict, Bang Lamung D... |
location_list = df_3_town['Address'].tolist()
list_of_lat_hos = df_3_town['Lat']
list_of_long_hos = df_3_town['Long']
# Zip Lat & Long to List of Coordinates
list_of_coordinates_hos = []
for lat, long in zip(list_of_lat_hos, list_of_long_hos):
list_of_coordinates_hos.append((lat,long))
url_1 = 'https://data.go.th/dataset/9bccd66e-8b14-414d-93d5-da044569350c/resource/a15653e5-05a2-48e7-aeaa-c721f2b088f9/download/data_station.csv'
df_sta= pd.read_csv(url_1)
print(df_sta.shape)
df_sta.head()
(691, 18)
id | station_code | name | en_name | th_short | en_short | chname | controldivision | exact_km | exact_distance | km | class | lat | long | active | giveway | dual_track | comment | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 1001 | กรุงเทพ | Bangkok | กท. | BKK | 曼谷 | 14 | 0 | 0 | 0 | 11 | 13.739277 | 100.517391 | 1 | 1 | 1 | NaN |
1 | 2 | 1002 | ยมราช | Yommaraj | ยช. | YMR | 勇马拉 | 14 | 2 | 2 | 2 | 99 | 0.00000 | 0.00000 | 1 | 1 | 1 | NaN |
2 | 3 | 1004 | สามเสน | Sam Sen | สส. | SAM | 三森 | 14 | 5 | 4 | 4 | 1 | 13.779293 | 100.529235 | 1 | 1 | 1 | NaN |
3 | 4 | 1006 | ประดิพัทธ์ | Pra Dipat | ปอิ. | PDP | 帕涤潘 | 14 | 6 | 6 | 6 | 99 | 0.00000 | 0.00000 | 1 | 1 | 1 | ป.สระอิ |
4 | 5 | 1007 | ชุมทางบางซื่อ | Bang Sue Junction | บซ. | BSJ | 邦苏总站 | 14 | 7 | 7 | 7 | 1 | 13.8043 | 100.54005 | 1 | 1 | 1 | NaN |
df_sta["lat"] = df_sta["lat"].map(lambda x: x.rstrip(','))
df_sta["long"] = df_sta["long"].map(lambda x: x.rstrip(" "))
df_sta["long"] = df_sta["long"].str.strip()
df_sta["lat"] = pd.to_numeric(df_sta["lat"])
df_sta["long"] = pd.to_numeric(df_sta["long"])
df_sta.drop(df_sta.index[df_sta['long'] == 0], inplace = True)
df_sta.drop(df_sta.index[df_sta['lat'] > 90], inplace = True)
print(df_sta.shape)
df_sta.head()
(487, 18)
id | station_code | name | en_name | th_short | en_short | chname | controldivision | exact_km | exact_distance | km | class | lat | long | active | giveway | dual_track | comment | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0 | 1 | 1001 | กรุงเทพ | Bangkok | กท. | BKK | 曼谷 | 14 | 0 | 0 | 0 | 11 | 13.739277 | 100.517391 | 1 | 1 | 1 | NaN |
2 | 3 | 1004 | สามเสน | Sam Sen | สส. | SAM | 三森 | 14 | 5 | 4 | 4 | 1 | 13.779293 | 100.529235 | 1 | 1 | 1 | NaN |
4 | 5 | 1007 | ชุมทางบางซื่อ | Bang Sue Junction | บซ. | BSJ | 邦苏总站 | 14 | 7 | 7 | 7 | 1 | 13.804300 | 100.540050 | 1 | 1 | 1 | NaN |
6 | 7 | 1011 | บางเขน | Bang Khen | บข. | BKH | 邦肯 | 14 | 13 | 13 | 13 | 1 | 13.846929 | 100.560654 | 1 | 1 | 1 | NaN |
8 | 9 | 1015 | หลักสี่ | Lak Si | ลส. | LKS | 拉四 | 14 | 18 | 17 | 17 | 1 | 13.883674 | 100.580690 | 1 | 1 | 1 | NaN |
location_list_sta = df_sta['en_name'].tolist()
list_of_lat_sta= df_sta['lat']
list_of_long_sta = df_sta['long']
# Zip Lat & Long to List of Coordinates
list_of_coordinates_sta = []
for lat, long in zip(list_of_lat_sta, list_of_long_sta):
list_of_coordinates_sta.append((lat,long))
location_list_sta = df_sta['en_name'].tolist()
from geopy.distance import geodesic
list_of_dist_sta = []
# list_of_coordinates -> Hospital Unit Coordinates
# Loop Theough the hospital Coordinates
for origin in list_of_coordinates_hos:
# Loop Through All Train Station in the List in -> "list_of_sta_coordinates"
for destination in range(0, len(list_of_coordinates_sta)):
#geodesic is a Function -> is use to Calculate the Distance between The Hospital
list_of_dist_sta.append(geodesic(origin,list_of_coordinates_sta[destination]).meters)
list_of_dist_sta.append(location_list_sta[destination])
list_of_dist_sta.append(list_of_coordinates_sta[destination])
len(location_list_sta)
487
len(list_of_dist_sta)
1025622
chunked_list2 = list()
chunk_size2 = 1461
for i in range(0, len(list_of_dist_sta), chunk_size2):
chunked_list2.append(list_of_dist_sta[i:i+chunk_size2])
list_of_dist_sta.clear()
# for i in range(0, len(chunked_list2)):
# print(chunked_list2[i])
# 1 index equal 1 Hospital
xnew = []
dist_sta = []
for j in range(0,len(chunked_list2)):
xnew = []
x = chunked_list2[j]
for i in range(0, len(x), 3):
xnew.append(x[i:i+3])
c = (min(xnew))
dist_sta.append(c)
len(dist_sta)
702
print("sta",len(list_of_coordinates_sta))
print("hos",len(list_of_coordinates_hos))
sta 487 hos 702
import geocoder
from geopy.geocoders import Nominatim
address = "thailand, ON"
geolocator = Nominatim(user_agent="thailand_explorer")
location = geolocator.geocode(address)
latitude = location.latitude
longitude = location.longitude
print('The geograpical coordinate of Thailand are {}, {}.'.format(latitude, longitude))
The geograpical coordinate of Thailand are 12.9330537, 100.8888005.
This map shows 3 cities (Khon Kaen, Chiang Mai and Chonburi)
import folium
map_th = folium.Map(location=[latitude, longitude], zoom_start=5)
for lat, lng in zip(
df_3_town['Lat'],
df_3_town['Long']):
folium.Marker(
[lat, lng],
radius=5,
color='blue',
fill=True,
fill_color='#3186cc',
fill_opacity=0.7,
parse_html=False).add_to(map_th)
map_th
Create the DataFrame of the distance between Hospital and Station for preparation to merge on the nearby place table after pulling data.
df_dist_sta = pd.DataFrame(dist_sta, columns =['Dist_sta', 'Station', 'Lat_Long_Sta'])
df_dist_sta.head()
Dist_sta | Station | Lat_Long_Sta | |
---|---|---|---|
0 | 5010.118103 | Chiang Mai | (18.782835, 99.01648) |
1 | 3942.471731 | Chiang Mai | (18.782835, 99.01648) |
2 | 2481.573228 | Khon Kaen | (16.426943, 102.825585) |
3 | 142202.140997 | Chiang Mai | (18.782835, 99.01648) |
4 | 2942.686004 | Pattaya | (12.940214, 100.909291) |
Get Data from Foursquare API
import requests
venues_list=[]
for i in range(len(df_3_town.index)):
lat = df_3_town['Lat'].iloc[i]
long = df_3_town['Long'].iloc[i]
names = df_3_town['Agency'].iloc[i]
location = df_3_town['Address'].iloc[i]
query = 'cafe'
# radius = 100000
url = f"https://api.foursquare.com/v3/places/nearby?&ll={lat}%2C{long}&query={query}"
headers = {
"Accept": "application/json",
"Authorization": "fsq3bdN5alD3QfFN/WdCXx8BPv7rqaMZGb1FvJf/NN1krOM="
}
response = requests.get(url, headers=headers)
response = response.json()["results"][0]
venues_list.append(response['name'])
if len(response['categories']) > 0:
venues_list.append(response['categories'][0]['name'])
else:
venues_list.append("no cat")
pass
venues_list.append(response['distance'])
venues_list.append(response['geocodes']['main']['latitude'])
venues_list.append(response['geocodes']['main']['longitude'])
venues_list.append(names)
venues_list.append(location)
chunked_list = list()
chunk_size = 7
for i in range(0, len(venues_list), chunk_size):
chunked_list.append(venues_list[i:i+chunk_size])
nearby_venues = pd.DataFrame(chunked_list, columns =['Name', 'Category', 'Dist_Venue', 'Lat_Venue', 'Long_Venue','Hospital',"Location"])
nearby_venues.head()
Name | Category | Dist_Venue | Lat_Venue | Long_Venue | Hospital | Location | |
---|---|---|---|---|---|---|---|
0 | Café Amazon (คาเฟ่ อเมซอน) | Coffee Shop | 99 | 18.789836 | 98.970468 | Department of Medicine, Neurological Hospital,... | Number 2, Suthep Road, Suthep Subdistrict, Mue... |
1 | Cafe de Garden (กาแฟในสวน) | Coffee Shop | 131 | 18.781916 | 98.979057 | Department of Mental Health, Suan Prung Hospital | Hai Ya Subdistrict, Mueang Chiang Mai District... |
2 | Changlong Cafe & Restaurant (ชางหลง Cafe & Res... | Chinese Restaurant | 1560 | 16.431177 | 102.835731 | Department of Mental Health, Khon Kaen Rajanag... | 169 Soi Kalaya, Chataphadung Road, Nai Mueang ... |
3 | Café Amazon (คาเฟ่ อเมซอน) | Coffee Shop | 2214 | 20.027149 | 99.285114 | Mae Ai Hospital Chiang Mai Province | 191 Moo 8, Fang-Thaton Road, Moo 8, Mae Ai Sub... |
4 | Café Amazon (คาเฟ่ อเมซอน) | Coffee Shop | 421 | 12.965142 | 100.909780 | Banglamung Hospital Chonburi Province | No. 6 Moo 5, Naklua Subdistrict, Bang Lamung D... |
df_3_town = df_3_town.reset_index().drop('index', axis=1)
df = nearby_venues
df['Dist_sta'] = df_dist_sta['Dist_sta']
df['Station'] = df_dist_sta['Station']
df['Lat_Long_Sta'] = df_dist_sta['Lat_Long_Sta']
df['H_lat'] = df_3_town['Lat']
df['H_long'] = df_3_town['Long']
cm =df[df['Location'].str.contains('Chiang Mai',case=False, regex=True)]
kk =df[df['Location'].str.contains('Khon Kaen',case=False, regex=True)]
cb =df[df['Location'].str.contains('Chonburi',case=False, regex=True)]
print("cm",cm.shape)
print("kk",kk.shape)
print("cb",cb.shape)
cm (296, 12) kk (278, 12) cb (128, 12)
cm2 = cm.sort_values(by=['Dist_sta'])
cm3 = cm.sort_values(by=['Dist_Venue'])
cm2.head(3)
Name | Category | Dist_Venue | Lat_Venue | Long_Venue | Hospital | Location | Dist_sta | Station | Lat_Long_Sta | H_lat | H_long | |
---|---|---|---|---|---|---|---|---|---|---|---|---|
616 | PUMPNOM CAFÉ (กาแฟ ปั๊มนม) | Café | 323 | 18.717873 | 99.028921 | Ban Yang Nueng Subdistrict Health Promoting Ho... | Moo 3, Yangneng Subdistrict, Saraphi District,... | 1289.889726 | Saraphi | (18.710173, 99.041886) | 18.71609 | 99.03135 |
618 | Nekoemon Café (เนโกะเอม่อน คาเฟ่) | Café | 2229 | 18.714073 | 99.059645 | Ban Si Song Muang Subdistrict Health Promoting... | Moo 2, Chaisathan Subdistrict, Saraphi Distric... | 2015.961792 | Saraphi | (18.710173, 99.041886) | 18.72820 | 99.04461 |
105 | Nekoemon Café (เนโกะเอม่อน คาเฟ่) | Café | 719 | 18.714073 | 99.059645 | Ban Phaya Chomphu Health Promoting Hospital, C... | Moo 2, Chompoo Subdistrict, Saraphi District, ... | 2040.205163 | Saraphi | (18.710173, 99.041886) | 18.70774 | 99.06106 |
cm3.head(10)
Name | Category | Dist_Venue | Lat_Venue | Long_Venue | Hospital | Location | Dist_sta | Station | Lat_Long_Sta | H_lat | H_long | |
---|---|---|---|---|---|---|---|---|---|---|---|---|
556 | MOON CAFE' Sansai Nongjom Chiangmai | Coffee Shop | 67 | 18.846888 | 99.019325 | Ban Nong Krai Health Promoting Hospital, Nong ... | Moo 6, Nong Chom Subdistrict, San Sai District... | 7104.198137 | Chiang Mai | (18.782835, 99.01648) | 18.84693 | 99.01997 |
398 | Come Cafe | Café | 71 | 17.949830 | 98.689887 | Doi Tao Hospital Chiang Mai Province | 105 Moo 3, Hot-Mae Taoy Road, Moo 3, Doi Tao S... | 68689.666137 | Nong Lom | (18.462368, 99.056907) | 17.94997 | 98.69055 |
525 | BKY steak cafe | Bistro | 73 | 18.618248 | 98.947560 | Ban Buak Khrok Subdistrict Health Promoting Ho... | Moo 2, Nong Tong Subdistrict, Hang Dong Distri... | 8113.991706 | Lamphun | (18.593556, 99.020686) | 18.61799 | 98.94820 |
9 | ฮ้านปันนา Punna Bookstore & Cafe | Café | 82 | 19.912554 | 99.206125 | Fang Hospital, Chiang Mai Province | 30 Moo 4, Chotana Road, Moo 4, Wiang Subdistri... | 126710.180102 | Chiang Mai | (18.782835, 99.01648) | 19.91320 | 99.20651 |
443 | Café Amazon (คาเฟ่ อเมซอน) | Coffee Shop | 91 | 18.851850 | 98.968399 | Nakhon Phing Hospital Chiang Mai Province | 159 Chotina Road, Moo 4, Mae Sa Subdistrict, M... | 9249.987285 | Chiang Mai | (18.782835, 99.01648) | 18.85227 | 98.96765 |
0 | Café Amazon (คาเฟ่ อเมซอน) | Coffee Shop | 99 | 18.789836 | 98.970468 | Department of Medicine, Neurological Hospital,... | Number 2, Suthep Road, Suthep Subdistrict, Mue... | 5010.118103 | Chiang Mai | (18.782835, 99.01648) | 18.78978 | 98.96952 |
474 | Cafe' De Atinge | no cat | 115 | 18.407656 | 98.673765 | Chomthong Hospital Chiang Mai Province | 259 Moo 2, Chiang Mai-Hot Road, Moo 2, Doi Kae... | 40873.020321 | Nong Lom | (18.462368, 99.056907) | 18.40682 | 98.67441 |
1 | Cafe de Garden (กาแฟในสวน) | Coffee Shop | 131 | 18.781916 | 98.979057 | Department of Mental Health, Suan Prung Hospital | Hai Ya Subdistrict, Mueang Chiang Mai District... | 3942.471731 | Chiang Mai | (18.782835, 99.01648) | 18.78074 | 98.97915 |
415 | Café Amazon (คาเฟ่ อเมซอน) | Coffee Shop | 179 | 19.369038 | 99.200552 | Phrao Hospital Chiang Mai Province | 181 Moo 4 Moo 4, Wiang Subdistrict, Phrao Dist... | 67540.839962 | Chiang Mai | (18.782835, 99.01648) | 19.36745 | 99.20024 |
635 | Kummoon Cafe | Café | 182 | 19.306933 | 99.189920 | Ban Pa Khaem Health Promoting Hospital, Mae Wa... | Moo 4, Mae Wan Subdistrict, Phrao District, Ch... | 60924.838264 | Chiang Mai | (18.782835, 99.01648) | 19.30744 | 99.19158 |
import folium
index = 1
Hlat= cm['H_lat'][index]
Hlong = cm['H_long'][index]
Slat = cm['Lat_Long_Sta'][index][0]
Slong = cm['Lat_Long_Sta'][index][1]
Vlat = cm['Lat_Venue'][index]
Vlong = cm['Long_Venue'][index]
a = (Hlat+Slat+Vlat)/3
b = (Hlong+Slong+Vlong)/3
map_th2 = folium.Map(location=[a, b], zoom_start=14)
tooltip1 = cm['Hospital'][index]
tooltip2 = cm['Station'][index] + " Station"
tooltip3 = cm['Name'][index]
folium.Marker(
location=[Hlat, Hlong],
popup=tooltip1,
icon=folium.Icon(color="red", icon="glyphicon glyphicon-plus"),tooltip=tooltip1
).add_to(map_th2)
folium.Marker(
location=[Slat, Slong],
popup=tooltip2,
icon=folium.Icon(color="blue",icon="train", prefix='fa'),tooltip=tooltip2
).add_to(map_th2)
folium.Marker(
location=[Vlat, Vlong],
popup=tooltip3,
icon=folium.Icon(color="green", icon="glyphicon glyphicon-cutlery"),tooltip=tooltip3
# icon="coffee", prefix='fa'
).add_to(map_th2)
print(cm['Hospital'][index])
print(cm['Station'][index] + " Station" ,"| Distance: " , "{:.0f}".format(cm['Dist_sta'][index])+ " m.")
print(cm['Name'][index],"| Distance: " , cm['Dist_Venue'][index],"m.")
map_th2
Department of Mental Health, Suan Prung Hospital Chiang Mai Station | Distance: 3942 m. Cafe de Garden (กาแฟในสวน) | Distance: 131 m.
import folium
index = 616
Hlat= cm['H_lat'][index]
Hlong = cm['H_long'][index]
Slat = cm['Lat_Long_Sta'][index][0]
Slong = cm['Lat_Long_Sta'][index][1]
Vlat = cm['Lat_Venue'][index]
Vlong = cm['Long_Venue'][index]
a = (Hlat+Slat+Vlat)/3
b = (Hlong+Slong+Vlong)/3
map_th2 = folium.Map(location=[a, b], zoom_start=16)
tooltip1 = cm['Hospital'][index]
tooltip2 = cm['Station'][index] + " Station"
tooltip3 = cm['Name'][index]
folium.Marker(
location=[Hlat, Hlong],
popup=tooltip1,
icon=folium.Icon(color="red", icon="glyphicon glyphicon-plus"),tooltip=tooltip1
).add_to(map_th2)
folium.Marker(
location=[Slat, Slong],
popup=tooltip2,
icon=folium.Icon(color="blue",icon="train", prefix='fa'),tooltip=tooltip2
).add_to(map_th2)
folium.Marker(
location=[Vlat, Vlong],
popup=tooltip3,
icon=folium.Icon(color="green", icon="glyphicon glyphicon-cutlery"),tooltip=tooltip3
# icon="coffee", prefix='fa'
).add_to(map_th2)
print(cm['Hospital'][index])
print(cm['Station'][index] + " Station" ,"| Distance: " , "{:.0f}".format(cm['Dist_sta'][index])+ " m.")
print(cm['Name'][index],"| Distance: " , cm['Dist_Venue'][index],"m.")
map_th2
Ban Yang Nueng Subdistrict Health Promoting Hospital, Yang Nueng District, Chiang Mai Province Saraphi Station | Distance: 1290 m. PUMPNOM CAFÉ (กาแฟ ปั๊มนม) | Distance: 323 m.
kk2 = kk.sort_values(by=['Dist_sta'])
kk3 = kk.sort_values(by=['Dist_Venue'])
kk3.head(10)
Name | Category | Dist_Venue | Lat_Venue | Long_Venue | Hospital | Location | Dist_sta | Station | Lat_Long_Sta | H_lat | H_long | |
---|---|---|---|---|---|---|---|---|---|---|---|---|
407 | Café Amazon (คาเฟ่ อเมซอน) | Coffee Shop | 132 | 16.134293 | 102.532805 | Petrola Hospital Khon Kaen Province | 316 Moo 14, Kut Khao Subdistrict, Manchayri Di... | 22126.502334 | Ban Phai | (16.059662, 102.725377) | 16.13501 | 102.5338 |
441 | CHA-LEE Cafe | Café | 152 | 16.708052 | 103.085952 | Somdej Phra Yupparat Kranuan Hospital Khon Kae... | 1 Moo 11, Nong Ko Subdistrict, Kranuan Distric... | 22979.175977 | Huai Sieo | (16.747454, 102.874905) | 16.70670 | 103.0862 |
95 | Warehouse Café 360 (แวร์เฮ้าส์คาเฟ่ 360) | Café | 224 | 16.489716 | 102.819715 | Ban Non Muang Health Promoting Hospital Khon K... | Moo 3, Sila Subdistrict, Mueang Khon Kaen Dist... | 3951.350782 | Samran | (16.51724, 102.842976) | 16.49089 | 102.8180 |
137 | Café Amazon (คาเฟ่ อเมซอน) | Coffee Shop | 280 | 16.671336 | 102.805016 | Ban Kham Kaen Koon Health Promoting Hospital K... | Moo 7, Muang Wan Subdistrict, Nam Phong Distri... | 3152.542474 | Non Phayom | (16.643394, 102.818675) | 16.66948 | 102.8068 |
409 | Café Amazon (คาเฟ่ อเมซอน) | Coffee Shop | 378 | 15.733382 | 102.790890 | Nong Song Hong Hospital Khon Kaen Province | 803 Moo 16 Nong Song Hong Subdistrict Nong Son... | 22885.752489 | Muang Phon | (15.819684, 102.600494) | 15.73298 | 102.7944 |
439 | YING cafe | Café | 389 | 16.432556 | 102.849203 | Khon Kaen Hospital Khon Kaen Province | Nai Mueang Subdistrict, Mueang Khon Kaen Distr... | 2543.556385 | Khon Kaen | (16.426943, 102.825585) | 16.42905 | 102.8493 |
308 | Café Amazon | Coffee Shop | 403 | 16.679657 | 102.709937 | Khok Sung Health Promoting Hospital Khon Kaen ... | Moo 1, Khok Sung Subdistrict, Ubolrat District... | 12672.711110 | Non Phayom | (16.643394, 102.818675) | 16.68137 | 102.7066 |
376 | Cafe' Amazon | Coffee Shop | 458 | 16.341665 | 102.800517 | Tha Phra Health Promoting Hospital Khon Kaen P... | Moo 10, Tha Phra Subdistrict, Mueang Khon Kaen... | 595.330858 | Tha Phra | (16.339858, 102.804867) | 16.34496 | 102.8031 |
457 | นมนัว | Coffee Shop | 526 | 16.092231 | 102.623590 | Rural hospital Khon Kaen Province | 231 Moo 11, Rural Subdistrict, Rural District,... | 11922.315010 | Ban Phai | (16.059662, 102.725377) | 16.09111 | 102.6188 |
469 | Café Amazon (คาเฟ่ อเมซอน) | Coffee Shop | 779 | 16.529749 | 102.829149 | Samran Health Promoting Hospital Khon Kaen Pro... | Moo 1, Samran Subdistrict, Mueang Khon Kaen Di... | 2569.122374 | Samran | (16.51724, 102.842976) | 16.53673 | 102.8299 |
import folium
index = 95
Hlat= kk['H_lat'][index]
Hlong = kk['H_long'][index]
Slat = kk['Lat_Long_Sta'][index][0]
Slong = kk['Lat_Long_Sta'][index][1]
Vlat = kk['Lat_Venue'][index]
Vlong = kk['Long_Venue'][index]
a = (Hlat+Slat+Vlat)/3
b = (Hlong+Slong+Vlong)/3
map_th2 = folium.Map(location=[a, b], zoom_start=14)
tooltip1 = kk['Hospital'][index]
tooltip2 = kk['Station'][index] + " Station"
tooltip3 = kk['Name'][index]
folium.Marker(
location=[Hlat, Hlong],
popup=tooltip1,
icon=folium.Icon(color="red", icon="glyphicon glyphicon-plus"),tooltip=tooltip1
).add_to(map_th2)
folium.Marker(
location=[Slat, Slong],
popup=tooltip2,
icon=folium.Icon(color="blue",icon="train", prefix='fa'),tooltip=tooltip2
).add_to(map_th2)
folium.Marker(
location=[Vlat, Vlong],
popup=tooltip3,
icon=folium.Icon(color="green", icon="glyphicon glyphicon-cutlery"),tooltip=tooltip3
# icon="coffee", prefix='fa'
).add_to(map_th2)
print(kk['Hospital'][index])
print(kk['Station'][index] + " Station" ,"| Distance: " , "{:.0f}".format(kk['Dist_sta'][index])+ " m.")
print(kk['Name'][index],"| Distance: " , kk['Dist_Venue'][index],"m.")
map_th2
Ban Non Muang Health Promoting Hospital Khon Kaen Province Samran Station | Distance: 3951 m. Warehouse Café 360 (แวร์เฮ้าส์คาเฟ่ 360) | Distance: 224 m.
import folium
index = 439
Hlat= kk['H_lat'][index]
Hlong = kk['H_long'][index]
Slat = kk['Lat_Long_Sta'][index][0]
Slong = kk['Lat_Long_Sta'][index][1]
Vlat = kk['Lat_Venue'][index]
Vlong = kk['Long_Venue'][index]
a = (Hlat+Slat+Vlat)/3
b = (Hlong+Slong+Vlong)/3
map_th2 = folium.Map(location=[a, b], zoom_start=15)
tooltip1 = kk['Hospital'][index]
tooltip2 = kk['Station'][index] + " Station"
tooltip3 = kk['Name'][index]
folium.Marker(
location=[Hlat, Hlong],
popup=tooltip1,
icon=folium.Icon(color="red", icon="glyphicon glyphicon-plus"),tooltip=tooltip1
).add_to(map_th2)
folium.Marker(
location=[Slat, Slong],
popup=tooltip2,
icon=folium.Icon(color="blue",icon="train", prefix='fa'),tooltip=tooltip2
).add_to(map_th2)
folium.Marker(
location=[Vlat, Vlong],
popup=tooltip3,
icon=folium.Icon(color="green", icon="glyphicon glyphicon-cutlery"),tooltip=tooltip3
# icon="coffee", prefix='fa'
).add_to(map_th2)
print(kk['Hospital'][index])
print(kk['Station'][index] + " Station" ,"| Distance: " , "{:.0f}".format(kk['Dist_sta'][index])+ " m.")
print(kk['Name'][index],"| Distance: " , kk['Dist_Venue'][index],"m.")
map_th2
Khon Kaen Hospital Khon Kaen Province Khon Kaen Station | Distance: 2544 m. YING cafe | Distance: 389 m.
cb2 = cb.sort_values(by=['Dist_sta'])
cb3 = cb.sort_values(by=['Dist_Venue'])
cb3.head(10)
Name | Category | Dist_Venue | Lat_Venue | Long_Venue | Hospital | Location | Dist_sta | Station | Lat_Long_Sta | H_lat | H_long | |
---|---|---|---|---|---|---|---|---|---|---|---|---|
192 | เครื่องหวาน Thai Dessert Cafe in Sattahip | Pastry Shop | 64 | 12.708670 | 100.888562 | Tambon Tao Than Health Promoting Hospital Chon... | Moo 8, Sattahip Subdistrict, Sattahip District... | 7626.636310 | Kao Chi Chan Junction | (12.733525, 100.954502) | 12.70842 | 100.8891 |
10 | Café Amazon (คาเฟ่ อเมซอน) | Coffee Shop | 66 | 13.351722 | 100.982093 | Chonburi Hospital Chonburi Province | No. 69 Moo 2, Ban Suan Subdistrict, Mueang Cho... | 1980.750677 | Chon Buri | (13.3423, 100.998185) | 13.35182 | 100.9827 |
280 | บ้านช่อง Café | Café | 131 | 12.600367 | 100.960151 | Ban Chong Samae San Health Promoting Hospital ... | Moo 2, Samaesarn Subdistrict, Sattahip Distric... | 11553.534829 | Ban Plu Ta Luang | (12.704562, 100.972436) | 12.60095 | 100.9591 |
220 | Cafe Amazon อีเทค | Coffee Shop | 219 | 13.415422 | 101.062670 | Nong Tamlueng Health Promoting Hospital Chonbu... | Moo 2, Nong Tamlueng Subdistrict, Phanthong Di... | 5846.253049 | Phan Thong | (13.46293, 101.081229) | 13.41359 | 101.0619 |
35 | Eye's Cafe | Café | 226 | 13.050408 | 101.065693 | Ban Bo Win Health Promoting Hospital Chonburi ... | Moo 5, Bowin Subdistrict, Sriracha District, C... | 13528.108673 | Bang Lamung | (13.034486, 100.939951) | 13.05049 | 101.0636 |
424 | Liep-Ing Cafe | Café | 235 | 13.162184 | 100.805138 | Koh Sichang Hospital Chonburi Province | Moo 1, Tha Thewa Wong Subdistrict, Koh Si Chan... | 12126.796441 | Laem Chabang | (13.098904, 100.898474) | 13.16239 | 100.8073 |
411 | CHIC Café & Restaurant | Café | 280 | 13.471496 | 101.097737 | Phanthong Hospital Chonburi Province | No. 1/10 Moo 8, Tambol Phanthong, Amphur Phant... | 1979.083185 | Phan Thong | (13.46293, 101.081229) | 13.46906 | 101.0984 |
379 | BKNT Cafe | Coffee Shop | 283 | 13.400895 | 101.189228 | Thung Khwang Health Promoting Hospital Chonbur... | Moo 8, Thung Khwang Subdistrict, Phanat Nikhom... | 13835.664313 | Phan Thong | (13.46293, 101.081229) | 13.39911 | 101.1911 |
405 | Café Amazon (คาเฟ่อเมซอน) | Coffee Shop | 287 | 13.117604 | 100.920637 | Laem Chabang Hospital Chonburi Province | Thungsukla Subdistrict, Sriracha District, Cho... | 2884.318049 | Laem Chabang | (13.098904, 100.898474) | 13.11595 | 100.9186 |
276 | Café Amazon (คาเฟ่ อเมซอน) | Coffee Shop | 329 | 12.759357 | 100.903125 | Bang Saray Health Promoting Hospital Chonburi ... | Moo 8, Bang Saray Subdistrict, Sattahip Distri... | 2999.212754 | Suan Nong Nuch | (12.7747625, 100.923996) | 12.76067 | 100.9004 |
import folium
index = 10
Hlat= cb['H_lat'][index]
Hlong = cb['H_long'][index]
Slat = cb['Lat_Long_Sta'][index][0]
Slong = cb['Lat_Long_Sta'][index][1]
Vlat = cb['Lat_Venue'][index]
Vlong = cb['Long_Venue'][index]
a = (Hlat+Slat+Vlat)/3
b = (Hlong+Slong+Vlong)/3
map_th2 = folium.Map(location=[a, b], zoom_start=15)
tooltip1 = cb['Hospital'][index]
tooltip2 = cb['Station'][index] + " Station"
tooltip3 = cb['Name'][index]
folium.Marker(
location=[Hlat, Hlong],
popup=tooltip1,
icon=folium.Icon(color="red", icon="glyphicon glyphicon-plus"),tooltip=tooltip1
).add_to(map_th2)
folium.Marker(
location=[Slat, Slong],
popup=tooltip2,
icon=folium.Icon(color="blue",icon="train", prefix='fa'),tooltip=tooltip2
).add_to(map_th2)
folium.Marker(
location=[Vlat, Vlong],
popup=tooltip3,
icon=folium.Icon(color="green", icon="glyphicon glyphicon-cutlery"),tooltip=tooltip3
# icon="coffee", prefix='fa'
).add_to(map_th2)
print(cb['Hospital'][index])
print(cb['Station'][index] + " Station" ,"| Distance: " , "{:.0f}".format(cb['Dist_sta'][index])+ " m.")
print(cb['Name'][index],"| Distance: " , cb['Dist_Venue'][index],"m.")
map_th2
Chonburi Hospital Chonburi Province Chon Buri Station | Distance: 1981 m. Café Amazon (คาเฟ่ อเมซอน) | Distance: 66 m.
import folium
index = 411
Hlat= cb['H_lat'][index]
Hlong = cb['H_long'][index]
Slat = cb['Lat_Long_Sta'][index][0]
Slong = cb['Lat_Long_Sta'][index][1]
Vlat = cb['Lat_Venue'][index]
Vlong = cb['Long_Venue'][index]
a = (Hlat+Slat+Vlat)/3
b = (Hlong+Slong+Vlong)/3
map_th2 = folium.Map(location=[a, b], zoom_start=15)
tooltip1 = cb['Hospital'][index]
tooltip2 = cb['Station'][index] + " Station"
tooltip3 = cb['Name'][index]
folium.Marker(
location=[Hlat, Hlong],
popup=tooltip1,
icon=folium.Icon(color="red", icon="glyphicon glyphicon-plus"),tooltip=tooltip1
).add_to(map_th2)
folium.Marker(
location=[Slat, Slong],
popup=tooltip2,
icon=folium.Icon(color="blue",icon="train", prefix='fa'),tooltip=tooltip2
).add_to(map_th2)
folium.Marker(
location=[Vlat, Vlong],
popup=tooltip3,
icon=folium.Icon(color="green", icon="glyphicon glyphicon-cutlery"),tooltip=tooltip3
# icon="coffee", prefix='fa'
).add_to(map_th2)
print(cb['Hospital'][index])
print(cb['Station'][index] + " Station" ,"| Distance: " , "{:.0f}".format(cb['Dist_sta'][index])+ " m.")
print(cb['Name'][index],"| Distance: " , cb['Dist_Venue'][index],"m.")
map_th2
Phanthong Hospital Chonburi Province Phan Thong Station | Distance: 1979 m. CHIC Café & Restaurant | Distance: 280 m.