Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save jinglescode/418a7ef75471dd891ae8621f36db6b62 to your computer and use it in GitHub Desktop.
Save jinglescode/418a7ef75471dd891ae8621f36db6b62 to your computer and use it in GitHub Desktop.
Article-Plan your perfect holiday.ipynb
Display the source blob
Display the rendered blob
Raw
{
"nbformat": 4,
"nbformat_minor": 0,
"metadata": {
"colab": {
"name": "Article-Plan your perfect holiday.ipynb",
"provenance": [],
"collapsed_sections": [],
"authorship_tag": "ABX9TyOFInhwKHuvLJFUknLKViAS",
"include_colab_link": true
},
"kernelspec": {
"name": "python3",
"display_name": "Python 3"
}
},
"cells": [
{
"cell_type": "markdown",
"metadata": {
"id": "view-in-github",
"colab_type": "text"
},
"source": [
"<a href=\"https://colab.research.google.com/gist/jinglescode/418a7ef75471dd891ae8621f36db6b62/article-plan-your-perfect-holiday.ipynb\" target=\"_parent\"><img src=\"https://colab.research.google.com/assets/colab-badge.svg\" alt=\"Open In Colab\"/></a>"
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "9gPQbUN2iV1Z",
"colab_type": "text"
},
"source": [
"# Setup\n",
"\n",
"There are 2 things you need before running this script:\n",
"1. You have to upload a `KML` file, which you can export it from Googles Maps. Open the `Files` drawer on the left, and upload your `.kml` file.\n",
"2. You need `Googles Map API key`, which you can get from [developers.google.com](https://developers.google.com/maps/documentation/javascript/get-api-key)\n",
"3. Set the `filename` and your `API key` below\n"
]
},
{
"cell_type": "code",
"metadata": {
"id": "K3qHZiGVRrwW",
"colab_type": "code",
"cellView": "form",
"colab": {}
},
"source": [
"#@title Define parameters\n",
"# YOUR_API_KEY\n",
"# KML_FILENAME.kml\n",
"\n",
"google_map_api_key = 'ZIzkSyDwhp5B0_nVor1X2wPgOLHYS3g3eLYmPLY' #@param {type:\"string\"}\n",
"kml_filename = 'Greece 2019 (public).kml' #@param {type:\"string\"}\n",
"num_days = '12' #@param [\"5\", \"7\", \"9\"] {allow-input: true}"
],
"execution_count": 0,
"outputs": []
},
{
"cell_type": "markdown",
"metadata": {
"id": "wSnFbMmuS6Kr",
"colab_type": "text"
},
"source": [
"# Load libraries and load KML file"
]
},
{
"cell_type": "code",
"metadata": {
"id": "yAGT-tXprgHA",
"colab_type": "code",
"cellView": "form",
"outputId": "d948dbd3-6750-4351-9495-aee90fbffd58",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
}
},
"source": [
"#@title Load libraries\n",
"import numpy as np\n",
"import pandas as pd\n",
"\n",
"from bs4 import BeautifulSoup\n",
"import IPython\n",
"print('Packages loaded')"
],
"execution_count": 2,
"outputs": [
{
"output_type": "stream",
"text": [
"Packages loaded\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "ETkd8nwrrgJK",
"colab_type": "code",
"outputId": "a422906f-8afa-4182-cad3-128893347627",
"cellView": "form",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 419
}
},
"source": [
"#@title Load KML file\n",
"\n",
"places = []\n",
"\n",
"with open(kml_filename, \"r\") as file:\n",
" content = file.readlines()\n",
" content = \"\".join(content)\n",
" bs_content = BeautifulSoup(content, \"xml\")\n",
"\n",
" placemarks = bs_content.findAll('Placemark')\n",
" for placemark in placemarks:\n",
"\n",
" coordinates = placemark.find('coordinates').text.strip()\n",
" long = coordinates.split(',')[0]\n",
" lat = coordinates.split(',')[1]\n",
"\n",
" places.append({\n",
" 'name': placemark.find('name').text.strip(),\n",
" 'lat': lat,\n",
" 'long': long\n",
" })\n",
"\n",
"places = pd.DataFrame(places)\n",
"places['lat'] = places['lat'].astype(float)\n",
"places['long'] = places['long'].astype(float)\n",
"\n",
"mean_lat = places['lat'].mean()\n",
"mean_long = places['long'].mean()\n",
"\n",
"places"
],
"execution_count": 3,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>name</th>\n",
" <th>lat</th>\n",
" <th>long</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Athens International Airport</td>\n",
" <td>37.935647</td>\n",
" <td>23.948416</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Ancient Agora of Athens</td>\n",
" <td>37.974651</td>\n",
" <td>23.721972</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Tzistarakis Mosque</td>\n",
" <td>37.975920</td>\n",
" <td>23.726032</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Roman Forum</td>\n",
" <td>37.974375</td>\n",
" <td>23.725544</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Theatre of Dionysus</td>\n",
" <td>37.970366</td>\n",
" <td>23.727855</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>71</th>\n",
" <td>Villa Rufolo</td>\n",
" <td>40.649005</td>\n",
" <td>14.612082</td>\n",
" </tr>\n",
" <tr>\n",
" <th>72</th>\n",
" <td>Villa Cimbrone</td>\n",
" <td>40.644230</td>\n",
" <td>14.611135</td>\n",
" </tr>\n",
" <tr>\n",
" <th>73</th>\n",
" <td>Terrazza dell'Infinito</td>\n",
" <td>40.642772</td>\n",
" <td>14.610373</td>\n",
" </tr>\n",
" <tr>\n",
" <th>74</th>\n",
" <td>Ravello Cathedral</td>\n",
" <td>40.649339</td>\n",
" <td>14.611932</td>\n",
" </tr>\n",
" <tr>\n",
" <th>75</th>\n",
" <td>Church of Saint John the Apostle of the Toro</td>\n",
" <td>40.651448</td>\n",
" <td>14.612626</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>76 rows × 3 columns</p>\n",
"</div>"
],
"text/plain": [
" name lat long\n",
"0 Athens International Airport 37.935647 23.948416\n",
"1 Ancient Agora of Athens 37.974651 23.721972\n",
"2 Tzistarakis Mosque 37.975920 23.726032\n",
"3 Roman Forum 37.974375 23.725544\n",
"4 Theatre of Dionysus 37.970366 23.727855\n",
".. ... ... ...\n",
"71 Villa Rufolo 40.649005 14.612082\n",
"72 Villa Cimbrone 40.644230 14.611135\n",
"73 Terrazza dell'Infinito 40.642772 14.610373\n",
"74 Ravello Cathedral 40.649339 14.611932\n",
"75 Church of Saint John the Apostle of the Toro 40.651448 14.612626\n",
"\n",
"[76 rows x 3 columns]"
]
},
"metadata": {
"tags": []
},
"execution_count": 3
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "fdOCdQ7nTmrU",
"colab_type": "text"
},
"source": [
"# Group locations into clusters and plot in Google Map"
]
},
{
"cell_type": "code",
"metadata": {
"id": "G0h6NKhkN9Tg",
"colab_type": "code",
"cellView": "form",
"outputId": "45c2e33a-e061-4dff-9b7e-9a8081c7dbe6",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 419
}
},
"source": [
"#@title Perform clustering with [sklearn](https://scikit-learn.org/stable/modules/generated/sklearn.cluster.KMeans.html)\n",
"\n",
"# get list of lat longs\n",
"places_lat_long = places[['lat','long']].values.tolist()\n",
"places_lat_long = np.array(places_lat_long)\n",
"\n",
"# cluster points\n",
"from sklearn.cluster import KMeans\n",
"kmeans = KMeans(n_clusters=int(num_days), random_state=0).fit(places_lat_long)\n",
"group = list(kmeans.labels_)\n",
"\n",
"# from sklearn.cluster import MeanShift, estimate_bandwidth\n",
"# bandwidth = estimate_bandwidth(places_lat_long, quantile=0.2)\n",
"# clustering = MeanShift(bandwidth=bandwidth).fit(places_lat_long)\n",
"# group = clustering.labels_\n",
"\n",
"# from sklearn.cluster import SpectralClustering\n",
"# clustering = SpectralClustering(n_clusters=9,\n",
"# assign_labels=\"discretize\",\n",
"# random_state=0).fit(places_lat_long)\n",
"# group = clustering.labels_\n",
"\n",
"# append group to dataframe\n",
"places['cluster'] = pd.Series(group, index=places.index)\n",
"\n",
"places"
],
"execution_count": 4,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>name</th>\n",
" <th>lat</th>\n",
" <th>long</th>\n",
" <th>cluster</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Athens International Airport</td>\n",
" <td>37.935647</td>\n",
" <td>23.948416</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Ancient Agora of Athens</td>\n",
" <td>37.974651</td>\n",
" <td>23.721972</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Tzistarakis Mosque</td>\n",
" <td>37.975920</td>\n",
" <td>23.726032</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Roman Forum</td>\n",
" <td>37.974375</td>\n",
" <td>23.725544</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Theatre of Dionysus</td>\n",
" <td>37.970366</td>\n",
" <td>23.727855</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>...</th>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" <td>...</td>\n",
" </tr>\n",
" <tr>\n",
" <th>71</th>\n",
" <td>Villa Rufolo</td>\n",
" <td>40.649005</td>\n",
" <td>14.612082</td>\n",
" <td>5</td>\n",
" </tr>\n",
" <tr>\n",
" <th>72</th>\n",
" <td>Villa Cimbrone</td>\n",
" <td>40.644230</td>\n",
" <td>14.611135</td>\n",
" <td>5</td>\n",
" </tr>\n",
" <tr>\n",
" <th>73</th>\n",
" <td>Terrazza dell'Infinito</td>\n",
" <td>40.642772</td>\n",
" <td>14.610373</td>\n",
" <td>5</td>\n",
" </tr>\n",
" <tr>\n",
" <th>74</th>\n",
" <td>Ravello Cathedral</td>\n",
" <td>40.649339</td>\n",
" <td>14.611932</td>\n",
" <td>5</td>\n",
" </tr>\n",
" <tr>\n",
" <th>75</th>\n",
" <td>Church of Saint John the Apostle of the Toro</td>\n",
" <td>40.651448</td>\n",
" <td>14.612626</td>\n",
" <td>5</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"<p>76 rows × 4 columns</p>\n",
"</div>"
],
"text/plain": [
" name lat long cluster\n",
"0 Athens International Airport 37.935647 23.948416 2\n",
"1 Ancient Agora of Athens 37.974651 23.721972 2\n",
"2 Tzistarakis Mosque 37.975920 23.726032 2\n",
"3 Roman Forum 37.974375 23.725544 2\n",
"4 Theatre of Dionysus 37.970366 23.727855 2\n",
".. ... ... ... ...\n",
"71 Villa Rufolo 40.649005 14.612082 5\n",
"72 Villa Cimbrone 40.644230 14.611135 5\n",
"73 Terrazza dell'Infinito 40.642772 14.610373 5\n",
"74 Ravello Cathedral 40.649339 14.611932 5\n",
"75 Church of Saint John the Apostle of the Toro 40.651448 14.612626 5\n",
"\n",
"[76 rows x 4 columns]"
]
},
"metadata": {
"tags": []
},
"execution_count": 4
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "JdbvPxPmQRNb",
"colab_type": "code",
"cellView": "form",
"outputId": "3470b611-45de-4e6d-d120-268262220c5b",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 592
}
},
"source": [
"#@title Plot on Google Maps\n",
"\n",
"IPython.display.HTML('''\n",
"\n",
"<div id=\"map\" style=\"width:100%; height:575px\"></div>\n",
"\n",
"<script src=\"https://maps.googleapis.com/maps/api/js?key='''+ google_map_api_key +'''\" type=\"text/javascript\"></script>\n",
"\n",
"<script type=\"text/javascript\">\n",
"\n",
" var markers = ''' + places.to_json(orient='records') + '''\n",
"\n",
" var latlng = new google.maps.LatLng(''' + str(mean_lat) + ''', ''' + str(mean_long) + ''');\n",
"\n",
" var mapOptions = {\n",
" zoom: 6,\n",
" center: latlng,\n",
" mapTypeId: google.maps.MapTypeId.TERRAIN\n",
" };\n",
"\n",
" map = new google.maps.Map(document.getElementById(\"map\"), mapOptions);\n",
"\n",
" var createMarker = function (info){\n",
" var marker = new google.maps.Marker({\n",
" map: map,\n",
" position: new google.maps.LatLng(info.lat, info.long),\n",
" title: info.name,\n",
" label: info.cluster.toString()\n",
" });\n",
"\n",
" var infowindow = new google.maps.InfoWindow({\n",
" content: info.city + \" (Day: \"+info.cluster+\")\"\n",
" });\n",
" marker.addListener('click', function() {\n",
" infowindow.open(map, marker);\n",
" });\n",
" };\n",
"\n",
" for (i = 0; i < markers.length; i++){\n",
" createMarker(markers[i]);\n",
" }\n",
"\n",
"</script>\n",
"''')\n"
],
"execution_count": 5,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/html": [
"\n",
"\n",
"<div id=\"map\" style=\"width:100%; height:575px\"></div>\n",
"\n",
"<script src=\"https://maps.googleapis.com/maps/api/js?key=AIzaSyDwng5L8_nVcy4X3wPgDXNBT8g3eLYmPAY\" type=\"text/javascript\"></script>\n",
"\n",
"<script type=\"text/javascript\">\n",
"\n",
" var markers = [{\"name\":\"Athens International Airport\",\"lat\":37.9356467,\"long\":23.9484156,\"cluster\":2},{\"name\":\"Ancient Agora of Athens\",\"lat\":37.9746507,\"long\":23.7219716,\"cluster\":2},{\"name\":\"Tzistarakis Mosque\",\"lat\":37.9759204,\"long\":23.7260321,\"cluster\":2},{\"name\":\"Roman Forum\",\"lat\":37.9743749,\"long\":23.7255435,\"cluster\":2},{\"name\":\"Theatre of Dionysus\",\"lat\":37.9703658,\"long\":23.7278553,\"cluster\":2},{\"name\":\"Parthenon\",\"lat\":37.9715285,\"long\":23.7267166,\"cluster\":2},{\"name\":\"Acropolis Museum\",\"lat\":37.9684499,\"long\":23.7285227,\"cluster\":2},{\"name\":\"Temple of Olympian Zeus\",\"lat\":37.9693,\"long\":23.7331,\"cluster\":2},{\"name\":\"Plaka\",\"lat\":37.9725529,\"long\":23.7303364,\"cluster\":2},{\"name\":\"Temple of Zeus\",\"lat\":37.9692838,\"long\":23.7331012,\"cluster\":2},{\"name\":\"Diporto - Secret underground restaurant\",\"lat\":37.9806622,\"long\":23.7257688,\"cluster\":2},{\"name\":\"Pl. Agias Irinis 2\",\"lat\":37.977418,\"long\":23.7280221,\"cluster\":2},{\"name\":\"Acropolis of Athens\",\"lat\":37.9715323,\"long\":23.7257492,\"cluster\":2},{\"name\":\"Guora Gate\",\"lat\":35.3672849,\"long\":24.4743986,\"cluster\":3},{\"name\":\"Fortezza Castle\",\"lat\":35.3719817,\"long\":24.4711202,\"cluster\":3},{\"name\":\"Rethimno\",\"lat\":35.3643615,\"long\":24.4821552,\"cluster\":3},{\"name\":\"Chania\",\"lat\":35.5138298,\"long\":24.0180367,\"cluster\":7},{\"name\":\"Heraklion Airport N. Kazantzakis\",\"lat\":35.3395798,\"long\":25.1747483,\"cluster\":6},{\"name\":\"Rimondi Fountain\",\"lat\":35.3699649,\"long\":24.4746396,\"cluster\":3},{\"name\":\"Venetian house old town Chania\",\"lat\":35.5178095,\"long\":24.0194471,\"cluster\":7},{\"name\":\"Old Venetian Harbour.\",\"lat\":35.5186444,\"long\":24.0198469,\"cluster\":7},{\"name\":\"Minoan Palace of Knossos\",\"lat\":35.2978186,\"long\":25.1631278,\"cluster\":6},{\"name\":\"Heraklion Archaeological Museum\",\"lat\":35.3388102,\"long\":25.1370125,\"cluster\":6},{\"name\":\"Elafonissi Beach (world best beach)\",\"lat\":35.2711801,\"long\":23.5412959,\"cluster\":4},{\"name\":\"Samaria Gorge\",\"lat\":35.2401297,\"long\":23.9612021,\"cluster\":11},{\"name\":\"Rethymno Apartment Old Town\",\"lat\":35.370969,\"long\":24.474725,\"cluster\":3},{\"name\":\"Balos Lagoon (one of Crete\\u2019s most famous images)\",\"lat\":35.5819373,\"long\":23.5888546,\"cluster\":4},{\"name\":\"Old Venetian Harbour.\",\"lat\":35.5186444,\"long\":24.0198469,\"cluster\":7},{\"name\":\"Monastery of Arkadi\",\"lat\":35.3098767,\"long\":24.6289434,\"cluster\":3},{\"name\":\"Falassarna Beach\",\"lat\":35.4947549,\"long\":23.5799626,\"cluster\":4},{\"name\":\"Phaistos Minoan Palace\",\"lat\":35.0514552,\"long\":24.8145463,\"cluster\":9},{\"name\":\"Lake Vouliagmeni\",\"lat\":37.8078002,\"long\":23.7855018,\"cluster\":2},{\"name\":\"Windmills of the Lasithi Plateau\",\"lat\":35.2043357,\"long\":25.4549372,\"cluster\":10},{\"name\":\"Loutro\",\"lat\":35.2000045,\"long\":24.0786653,\"cluster\":11},{\"name\":\"Panagia\",\"lat\":36.4622821,\"long\":25.4036537,\"cluster\":1},{\"name\":\"Byzantine Castle Ruins\",\"lat\":36.4601095,\"long\":25.3727337,\"cluster\":1},{\"name\":\"Ammo\\u00fadi\",\"lat\":36.4581849,\"long\":25.3716543,\"cluster\":1},{\"name\":\"Virgin Mary Orthodox Church-Three Bells of Fira\",\"lat\":36.4233169,\"long\":25.4283235,\"cluster\":1},{\"name\":\"Skaros Rock\",\"lat\":36.4323346,\"long\":25.4181451,\"cluster\":1},{\"name\":\"Orthodox Metropolitan Cathedral\",\"lat\":36.4169422,\"long\":25.4316957,\"cluster\":1},{\"name\":\"Akrotiri\",\"lat\":36.3517952,\"long\":25.403447,\"cluster\":1},{\"name\":\"Santo\",\"lat\":36.387564,\"long\":25.436746,\"cluster\":1},{\"name\":\"ArtSpace\",\"lat\":36.386002,\"long\":25.460343,\"cluster\":1},{\"name\":\"Venetsanos Winery\",\"lat\":36.382309,\"long\":25.431597,\"cluster\":1},{\"name\":\"Gavalas Winery\",\"lat\":36.375391,\"long\":25.430395,\"cluster\":1},{\"name\":\"Perissa Black Sand Beach\",\"lat\":36.3537182,\"long\":25.4736753,\"cluster\":1},{\"name\":\"Fira Skala Thiras\",\"lat\":36.4181936,\"long\":25.4277598,\"cluster\":1},{\"name\":\"Ammo\\u00fadi\",\"lat\":36.4581849,\"long\":25.3716543,\"cluster\":1},{\"name\":\"Gino e Toto Sorbillo (best pizza)\",\"lat\":40.8504129,\"long\":14.2553176,\"cluster\":0},{\"name\":\"Naples International Airport\",\"lat\":40.8847493,\"long\":14.289243,\"cluster\":0},{\"name\":\"Starita (best pizza)\",\"lat\":40.8559232,\"long\":14.2463808,\"cluster\":0},{\"name\":\"L'Antica Pizzeria da Michele (really best pizza)\",\"lat\":40.8497563,\"long\":14.2633002,\"cluster\":0},{\"name\":\"Attanasio - Ristorante tipico napoletano\",\"lat\":40.8517091,\"long\":14.270283,\"cluster\":0},{\"name\":\"La Cantinaccia del Popolo\",\"lat\":40.6275728,\"long\":14.3840332,\"cluster\":8},{\"name\":\"L'Antica Trattoria\",\"lat\":40.626762,\"long\":14.373122,\"cluster\":8},{\"name\":\"Rossellinis c\\/o Palazzo Avino\",\"lat\":40.6509636,\"long\":14.6131813,\"cluster\":5},{\"name\":\"La Zagara\",\"lat\":40.6295968,\"long\":14.4864272,\"cluster\":8},{\"name\":\"Cafe Positano\",\"lat\":40.6278314,\"long\":14.4851504,\"cluster\":8},{\"name\":\"Restaurant Zi Ntonio\",\"lat\":40.6266612,\"long\":14.3752132,\"cluster\":8},{\"name\":\"Torre Normanna (high review, exp)\",\"lat\":40.6440695,\"long\":14.6475589,\"cluster\":5},{\"name\":\"Le Bont\\u00e0 del Capo\",\"lat\":40.617118,\"long\":14.5679731,\"cluster\":5},{\"name\":\"Bar del Carmine\",\"lat\":40.6265254,\"long\":14.3765625,\"cluster\":8},{\"name\":\"Professor Coffee\",\"lat\":40.7858178,\"long\":14.3640114,\"cluster\":0},{\"name\":\"Hotel Villa Maria - Giordano - Villa Eva\",\"lat\":40.646778,\"long\":14.6103707,\"cluster\":5},{\"name\":\"Villa Cimbrone\",\"lat\":40.6442298,\"long\":14.6111347,\"cluster\":5},{\"name\":\"Villa Rufolo\",\"lat\":40.6490049,\"long\":14.6120824,\"cluster\":5},{\"name\":\"Enotavola Wine Bar\",\"lat\":40.6499741,\"long\":14.6110118,\"cluster\":5},{\"name\":\"Baffone Gelateria Artigianale\",\"lat\":40.650581,\"long\":14.611408,\"cluster\":5},{\"name\":\"Villa Comunale\",\"lat\":40.6280369,\"long\":14.3736448,\"cluster\":8},{\"name\":\"Chiostro di San Francesco\",\"lat\":40.6279257,\"long\":14.3731768,\"cluster\":8},{\"name\":\"Vallone dei Mulini\",\"lat\":40.6251943,\"long\":14.3763714,\"cluster\":8},{\"name\":\"Villa Rufolo\",\"lat\":40.6490049,\"long\":14.6120824,\"cluster\":5},{\"name\":\"Villa Cimbrone\",\"lat\":40.6442298,\"long\":14.6111347,\"cluster\":5},{\"name\":\"Terrazza dell'Infinito\",\"lat\":40.6427723,\"long\":14.6103727,\"cluster\":5},{\"name\":\"Ravello Cathedral\",\"lat\":40.6493387,\"long\":14.6119318,\"cluster\":5},{\"name\":\"Church of Saint John the Apostle of the Toro\",\"lat\":40.6514483,\"long\":14.6126257,\"cluster\":5}]\n",
"\n",
" var latlng = new google.maps.LatLng(37.99398914736844, 20.80448787105263);\n",
"\n",
" var mapOptions = {\n",
" zoom: 6,\n",
" center: latlng,\n",
" mapTypeId: google.maps.MapTypeId.TERRAIN\n",
" };\n",
"\n",
" map = new google.maps.Map(document.getElementById(\"map\"), mapOptions);\n",
"\n",
" var createMarker = function (info){\n",
" var marker = new google.maps.Marker({\n",
" map: map,\n",
" position: new google.maps.LatLng(info.lat, info.long),\n",
" title: info.name,\n",
" label: info.cluster.toString()\n",
" });\n",
"\n",
" var infowindow = new google.maps.InfoWindow({\n",
" content: info.city + \" (Day: \"+info.cluster+\")\"\n",
" });\n",
" marker.addListener('click', function() {\n",
" infowindow.open(map, marker);\n",
" });\n",
" };\n",
"\n",
" for (i = 0; i < markers.length; i++){\n",
" createMarker(markers[i]);\n",
" }\n",
"\n",
"</script>\n"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {
"tags": []
},
"execution_count": 5
}
]
},
{
"cell_type": "markdown",
"metadata": {
"id": "oF8jT97Cf2NX",
"colab_type": "text"
},
"source": [
"# Calculate distance between coordinates and find shortest path"
]
},
{
"cell_type": "code",
"metadata": {
"id": "gakoxjJe3yT4",
"colab_type": "code",
"cellView": "form",
"outputId": "9ebfb09c-1869-42d3-a5bd-26b76b76841f",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 452
}
},
"source": [
"#@title Find the middle point of each cluster\n",
"mean_lat_long_by_group = places.groupby('cluster').mean()\n",
"mean_lat_long_by_group"
],
"execution_count": 6,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>lat</th>\n",
" <th>long</th>\n",
" </tr>\n",
" <tr>\n",
" <th>cluster</th>\n",
" <th></th>\n",
" <th></th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>40.846395</td>\n",
" <td>14.281423</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>36.411881</td>\n",
" <td>25.418702</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>37.958535</td>\n",
" <td>23.747617</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>35.359073</td>\n",
" <td>24.500997</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>35.449291</td>\n",
" <td>23.570038</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>40.645347</td>\n",
" <td>14.610990</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>35.325403</td>\n",
" <td>25.158296</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>35.517232</td>\n",
" <td>24.019294</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>40.627345</td>\n",
" <td>14.400411</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>35.051455</td>\n",
" <td>24.814546</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>35.204336</td>\n",
" <td>25.454937</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>35.220067</td>\n",
" <td>24.019934</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" lat long\n",
"cluster \n",
"0 40.846395 14.281423\n",
"1 36.411881 25.418702\n",
"2 37.958535 23.747617\n",
"3 35.359073 24.500997\n",
"4 35.449291 23.570038\n",
"5 40.645347 14.610990\n",
"6 35.325403 25.158296\n",
"7 35.517232 24.019294\n",
"8 40.627345 14.400411\n",
"9 35.051455 24.814546\n",
"10 35.204336 25.454937\n",
"11 35.220067 24.019934"
]
},
"metadata": {
"tags": []
},
"execution_count": 6
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "XLXgEALSzDJz",
"colab_type": "code",
"cellView": "form",
"outputId": "40aa1f99-b5e3-4a3b-cc50-e7c1c5c26680",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 441
}
},
"source": [
"#@title Calculate distance between coordinates\n",
"from scipy.spatial.distance import cdist\n",
"\n",
"distance_matrix = cdist(\n",
" mean_lat_long_by_group.values, \n",
" mean_lat_long_by_group.values\n",
")\n",
"\n",
"df_distance_matrix = pd.DataFrame(distance_matrix)\n",
"df_distance_matrix"
],
"execution_count": 7,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>0</th>\n",
" <th>1</th>\n",
" <th>2</th>\n",
" <th>3</th>\n",
" <th>4</th>\n",
" <th>5</th>\n",
" <th>6</th>\n",
" <th>7</th>\n",
" <th>8</th>\n",
" <th>9</th>\n",
" <th>10</th>\n",
" <th>11</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>0.000000</td>\n",
" <td>11.987656</td>\n",
" <td>9.896897</td>\n",
" <td>11.599586</td>\n",
" <td>10.742770</td>\n",
" <td>0.386050</td>\n",
" <td>12.197858</td>\n",
" <td>11.100726</td>\n",
" <td>0.249281</td>\n",
" <td>12.021981</td>\n",
" <td>12.517198</td>\n",
" <td>11.246962</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>11.987656</td>\n",
" <td>0.000000</td>\n",
" <td>2.276986</td>\n",
" <td>1.396634</td>\n",
" <td>2.084259</td>\n",
" <td>11.607277</td>\n",
" <td>1.117249</td>\n",
" <td>1.660945</td>\n",
" <td>11.797155</td>\n",
" <td>1.488543</td>\n",
" <td>1.208088</td>\n",
" <td>1.837654</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>9.896897</td>\n",
" <td>2.276986</td>\n",
" <td>0.000000</td>\n",
" <td>2.706433</td>\n",
" <td>2.515520</td>\n",
" <td>9.523493</td>\n",
" <td>2.987206</td>\n",
" <td>2.456373</td>\n",
" <td>9.720741</td>\n",
" <td>3.096684</td>\n",
" <td>3.240456</td>\n",
" <td>2.751974</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>11.599586</td>\n",
" <td>1.396634</td>\n",
" <td>2.706433</td>\n",
" <td>0.000000</td>\n",
" <td>0.935321</td>\n",
" <td>11.214140</td>\n",
" <td>0.658161</td>\n",
" <td>0.507003</td>\n",
" <td>11.391950</td>\n",
" <td>0.439252</td>\n",
" <td>0.966409</td>\n",
" <td>0.500744</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>10.742770</td>\n",
" <td>2.084259</td>\n",
" <td>2.515520</td>\n",
" <td>0.935321</td>\n",
" <td>0.000000</td>\n",
" <td>10.356811</td>\n",
" <td>1.593083</td>\n",
" <td>0.454365</td>\n",
" <td>10.530636</td>\n",
" <td>1.306551</td>\n",
" <td>1.900750</td>\n",
" <td>0.504926</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>0.386050</td>\n",
" <td>11.607277</td>\n",
" <td>9.523493</td>\n",
" <td>11.214140</td>\n",
" <td>10.356811</td>\n",
" <td>0.000000</td>\n",
" <td>11.813022</td>\n",
" <td>10.715118</td>\n",
" <td>0.211347</td>\n",
" <td>11.636331</td>\n",
" <td>12.132428</td>\n",
" <td>10.861026</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>12.197858</td>\n",
" <td>1.117249</td>\n",
" <td>2.987206</td>\n",
" <td>0.658161</td>\n",
" <td>1.593083</td>\n",
" <td>11.813022</td>\n",
" <td>0.000000</td>\n",
" <td>1.155043</td>\n",
" <td>11.993443</td>\n",
" <td>0.439558</td>\n",
" <td>0.320395</td>\n",
" <td>1.143226</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>11.100726</td>\n",
" <td>1.660945</td>\n",
" <td>2.456373</td>\n",
" <td>0.507003</td>\n",
" <td>0.454365</td>\n",
" <td>10.715118</td>\n",
" <td>1.155043</td>\n",
" <td>0.000000</td>\n",
" <td>10.892023</td>\n",
" <td>0.921615</td>\n",
" <td>1.469345</td>\n",
" <td>0.297166</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>0.249281</td>\n",
" <td>11.797155</td>\n",
" <td>9.720741</td>\n",
" <td>11.391950</td>\n",
" <td>10.530636</td>\n",
" <td>0.211347</td>\n",
" <td>11.993443</td>\n",
" <td>10.892023</td>\n",
" <td>0.000000</td>\n",
" <td>11.812906</td>\n",
" <td>12.313065</td>\n",
" <td>11.035120</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>12.021981</td>\n",
" <td>1.488543</td>\n",
" <td>3.096684</td>\n",
" <td>0.439252</td>\n",
" <td>1.306551</td>\n",
" <td>11.636331</td>\n",
" <td>0.439558</td>\n",
" <td>0.921615</td>\n",
" <td>11.812906</td>\n",
" <td>0.000000</td>\n",
" <td>0.658387</td>\n",
" <td>0.812305</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>12.517198</td>\n",
" <td>1.208088</td>\n",
" <td>3.240456</td>\n",
" <td>0.966409</td>\n",
" <td>1.900750</td>\n",
" <td>12.132428</td>\n",
" <td>0.320395</td>\n",
" <td>1.469345</td>\n",
" <td>12.313065</td>\n",
" <td>0.658387</td>\n",
" <td>0.000000</td>\n",
" <td>1.435090</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>11.246962</td>\n",
" <td>1.837654</td>\n",
" <td>2.751974</td>\n",
" <td>0.500744</td>\n",
" <td>0.504926</td>\n",
" <td>10.861026</td>\n",
" <td>1.143226</td>\n",
" <td>0.297166</td>\n",
" <td>11.035120</td>\n",
" <td>0.812305</td>\n",
" <td>1.435090</td>\n",
" <td>0.000000</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" 0 1 2 ... 9 10 11\n",
"0 0.000000 11.987656 9.896897 ... 12.021981 12.517198 11.246962\n",
"1 11.987656 0.000000 2.276986 ... 1.488543 1.208088 1.837654\n",
"2 9.896897 2.276986 0.000000 ... 3.096684 3.240456 2.751974\n",
"3 11.599586 1.396634 2.706433 ... 0.439252 0.966409 0.500744\n",
"4 10.742770 2.084259 2.515520 ... 1.306551 1.900750 0.504926\n",
"5 0.386050 11.607277 9.523493 ... 11.636331 12.132428 10.861026\n",
"6 12.197858 1.117249 2.987206 ... 0.439558 0.320395 1.143226\n",
"7 11.100726 1.660945 2.456373 ... 0.921615 1.469345 0.297166\n",
"8 0.249281 11.797155 9.720741 ... 11.812906 12.313065 11.035120\n",
"9 12.021981 1.488543 3.096684 ... 0.000000 0.658387 0.812305\n",
"10 12.517198 1.208088 3.240456 ... 0.658387 0.000000 1.435090\n",
"11 11.246962 1.837654 2.751974 ... 0.812305 1.435090 0.000000\n",
"\n",
"[12 rows x 12 columns]"
]
},
"metadata": {
"tags": []
},
"execution_count": 7
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "lP1icITPuWp4",
"colab_type": "code",
"cellView": "form",
"outputId": "0157b134-b006-4929-a359-f9136a2273d2",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 34
}
},
"source": [
"#@title Find shortest path\n",
"\n",
"starting_point = 2#@param {type:\"integer\"}\n",
"cur_index = starting_point\n",
"\n",
"seq = [cur_index]\n",
"while len(seq) < len(list(df_distance_matrix.keys())):\n",
" nearest_clusters = list(df_distance_matrix[cur_index].sort_values().index)\n",
" for cluster_id in nearest_clusters:\n",
" if cluster_id != cur_index and cluster_id not in seq:\n",
" seq.append(cluster_id)\n",
" cur_index = cluster_id\n",
" break\n",
"\n",
"replace_group_to_day = {}\n",
"\n",
"for i in range(0, len(seq)):\n",
" replace_group_to_day[seq[i]] = i\n",
"\n",
"print(' -> '.join(str(x) for x in seq))\n",
"\n",
"places['days'] = places['cluster']\n",
"places['days'].replace(replace_group_to_day, inplace=True)\n",
"places['days'] += 1"
],
"execution_count": 8,
"outputs": [
{
"output_type": "stream",
"text": [
"2 -> 1 -> 6 -> 10 -> 9 -> 3 -> 11 -> 7 -> 4 -> 5 -> 8 -> 0\n"
],
"name": "stdout"
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "07k_q2QeecOr",
"colab_type": "code",
"cellView": "form",
"outputId": "1405c292-82e0-49d0-89fe-6e5577f91cad",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 717
}
},
"source": [
"#@title Plot on Google Maps\n",
"IPython.display.HTML('''\n",
"\n",
"<div id=\"map\" style=\"width:100%; height:700px\"></div>\n",
"\n",
"<script src=\"https://maps.googleapis.com/maps/api/js?key='''+ google_map_api_key +'''\" type=\"text/javascript\"></script>\n",
"\n",
"<script type=\"text/javascript\">\n",
"\n",
" var markers = ''' + places.to_json(orient='records') + '''\n",
"\n",
" var latlng = new google.maps.LatLng(''' + str(mean_lat) + ''', ''' + str(mean_long) + ''');\n",
"\n",
" var mapOptions = {\n",
" zoom: 6,\n",
" center: latlng,\n",
" mapTypeId: google.maps.MapTypeId.TERRAIN\n",
" };\n",
"\n",
" map = new google.maps.Map(document.getElementById(\"map\"), mapOptions);\n",
"\n",
" var createMarker = function (info){\n",
" var marker = new google.maps.Marker({\n",
" map: map,\n",
" position: new google.maps.LatLng(info.lat, info.long),\n",
" title: info.name,\n",
" label: info.days.toString()\n",
" });\n",
"\n",
" var infowindow = new google.maps.InfoWindow({\n",
" content: info.name + \" (Day: \"+info.days+\")\"\n",
" });\n",
" marker.addListener('click', function() {\n",
" infowindow.open(map, marker);\n",
" });\n",
" };\n",
"\n",
" for (i = 0; i < markers.length; i++){\n",
" createMarker(markers[i]);\n",
" }\n",
"\n",
"</script>\n",
"''')\n"
],
"execution_count": 9,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/html": [
"\n",
"\n",
"<div id=\"map\" style=\"width:100%; height:700px\"></div>\n",
"\n",
"<script src=\"https://maps.googleapis.com/maps/api/js?key=AIzaSyDwng5L8_nVcy4X3wPgDXNBT8g3eLYmPAY\" type=\"text/javascript\"></script>\n",
"\n",
"<script type=\"text/javascript\">\n",
"\n",
" var markers = [{\"name\":\"Athens International Airport\",\"lat\":37.9356467,\"long\":23.9484156,\"cluster\":2,\"days\":1},{\"name\":\"Ancient Agora of Athens\",\"lat\":37.9746507,\"long\":23.7219716,\"cluster\":2,\"days\":1},{\"name\":\"Tzistarakis Mosque\",\"lat\":37.9759204,\"long\":23.7260321,\"cluster\":2,\"days\":1},{\"name\":\"Roman Forum\",\"lat\":37.9743749,\"long\":23.7255435,\"cluster\":2,\"days\":1},{\"name\":\"Theatre of Dionysus\",\"lat\":37.9703658,\"long\":23.7278553,\"cluster\":2,\"days\":1},{\"name\":\"Parthenon\",\"lat\":37.9715285,\"long\":23.7267166,\"cluster\":2,\"days\":1},{\"name\":\"Acropolis Museum\",\"lat\":37.9684499,\"long\":23.7285227,\"cluster\":2,\"days\":1},{\"name\":\"Temple of Olympian Zeus\",\"lat\":37.9693,\"long\":23.7331,\"cluster\":2,\"days\":1},{\"name\":\"Plaka\",\"lat\":37.9725529,\"long\":23.7303364,\"cluster\":2,\"days\":1},{\"name\":\"Temple of Zeus\",\"lat\":37.9692838,\"long\":23.7331012,\"cluster\":2,\"days\":1},{\"name\":\"Diporto - Secret underground restaurant\",\"lat\":37.9806622,\"long\":23.7257688,\"cluster\":2,\"days\":1},{\"name\":\"Pl. Agias Irinis 2\",\"lat\":37.977418,\"long\":23.7280221,\"cluster\":2,\"days\":1},{\"name\":\"Acropolis of Athens\",\"lat\":37.9715323,\"long\":23.7257492,\"cluster\":2,\"days\":1},{\"name\":\"Guora Gate\",\"lat\":35.3672849,\"long\":24.4743986,\"cluster\":3,\"days\":6},{\"name\":\"Fortezza Castle\",\"lat\":35.3719817,\"long\":24.4711202,\"cluster\":3,\"days\":6},{\"name\":\"Rethimno\",\"lat\":35.3643615,\"long\":24.4821552,\"cluster\":3,\"days\":6},{\"name\":\"Chania\",\"lat\":35.5138298,\"long\":24.0180367,\"cluster\":7,\"days\":8},{\"name\":\"Heraklion Airport N. Kazantzakis\",\"lat\":35.3395798,\"long\":25.1747483,\"cluster\":6,\"days\":3},{\"name\":\"Rimondi Fountain\",\"lat\":35.3699649,\"long\":24.4746396,\"cluster\":3,\"days\":6},{\"name\":\"Venetian house old town Chania\",\"lat\":35.5178095,\"long\":24.0194471,\"cluster\":7,\"days\":8},{\"name\":\"Old Venetian Harbour.\",\"lat\":35.5186444,\"long\":24.0198469,\"cluster\":7,\"days\":8},{\"name\":\"Minoan Palace of Knossos\",\"lat\":35.2978186,\"long\":25.1631278,\"cluster\":6,\"days\":3},{\"name\":\"Heraklion Archaeological Museum\",\"lat\":35.3388102,\"long\":25.1370125,\"cluster\":6,\"days\":3},{\"name\":\"Elafonissi Beach (world best beach)\",\"lat\":35.2711801,\"long\":23.5412959,\"cluster\":4,\"days\":9},{\"name\":\"Samaria Gorge\",\"lat\":35.2401297,\"long\":23.9612021,\"cluster\":11,\"days\":7},{\"name\":\"Rethymno Apartment Old Town\",\"lat\":35.370969,\"long\":24.474725,\"cluster\":3,\"days\":6},{\"name\":\"Balos Lagoon (one of Crete\\u2019s most famous images)\",\"lat\":35.5819373,\"long\":23.5888546,\"cluster\":4,\"days\":9},{\"name\":\"Old Venetian Harbour.\",\"lat\":35.5186444,\"long\":24.0198469,\"cluster\":7,\"days\":8},{\"name\":\"Monastery of Arkadi\",\"lat\":35.3098767,\"long\":24.6289434,\"cluster\":3,\"days\":6},{\"name\":\"Falassarna Beach\",\"lat\":35.4947549,\"long\":23.5799626,\"cluster\":4,\"days\":9},{\"name\":\"Phaistos Minoan Palace\",\"lat\":35.0514552,\"long\":24.8145463,\"cluster\":9,\"days\":5},{\"name\":\"Lake Vouliagmeni\",\"lat\":37.8078002,\"long\":23.7855018,\"cluster\":2,\"days\":1},{\"name\":\"Windmills of the Lasithi Plateau\",\"lat\":35.2043357,\"long\":25.4549372,\"cluster\":10,\"days\":4},{\"name\":\"Loutro\",\"lat\":35.2000045,\"long\":24.0786653,\"cluster\":11,\"days\":7},{\"name\":\"Panagia\",\"lat\":36.4622821,\"long\":25.4036537,\"cluster\":1,\"days\":2},{\"name\":\"Byzantine Castle Ruins\",\"lat\":36.4601095,\"long\":25.3727337,\"cluster\":1,\"days\":2},{\"name\":\"Ammo\\u00fadi\",\"lat\":36.4581849,\"long\":25.3716543,\"cluster\":1,\"days\":2},{\"name\":\"Virgin Mary Orthodox Church-Three Bells of Fira\",\"lat\":36.4233169,\"long\":25.4283235,\"cluster\":1,\"days\":2},{\"name\":\"Skaros Rock\",\"lat\":36.4323346,\"long\":25.4181451,\"cluster\":1,\"days\":2},{\"name\":\"Orthodox Metropolitan Cathedral\",\"lat\":36.4169422,\"long\":25.4316957,\"cluster\":1,\"days\":2},{\"name\":\"Akrotiri\",\"lat\":36.3517952,\"long\":25.403447,\"cluster\":1,\"days\":2},{\"name\":\"Santo\",\"lat\":36.387564,\"long\":25.436746,\"cluster\":1,\"days\":2},{\"name\":\"ArtSpace\",\"lat\":36.386002,\"long\":25.460343,\"cluster\":1,\"days\":2},{\"name\":\"Venetsanos Winery\",\"lat\":36.382309,\"long\":25.431597,\"cluster\":1,\"days\":2},{\"name\":\"Gavalas Winery\",\"lat\":36.375391,\"long\":25.430395,\"cluster\":1,\"days\":2},{\"name\":\"Perissa Black Sand Beach\",\"lat\":36.3537182,\"long\":25.4736753,\"cluster\":1,\"days\":2},{\"name\":\"Fira Skala Thiras\",\"lat\":36.4181936,\"long\":25.4277598,\"cluster\":1,\"days\":2},{\"name\":\"Ammo\\u00fadi\",\"lat\":36.4581849,\"long\":25.3716543,\"cluster\":1,\"days\":2},{\"name\":\"Gino e Toto Sorbillo (best pizza)\",\"lat\":40.8504129,\"long\":14.2553176,\"cluster\":0,\"days\":12},{\"name\":\"Naples International Airport\",\"lat\":40.8847493,\"long\":14.289243,\"cluster\":0,\"days\":12},{\"name\":\"Starita (best pizza)\",\"lat\":40.8559232,\"long\":14.2463808,\"cluster\":0,\"days\":12},{\"name\":\"L'Antica Pizzeria da Michele (really best pizza)\",\"lat\":40.8497563,\"long\":14.2633002,\"cluster\":0,\"days\":12},{\"name\":\"Attanasio - Ristorante tipico napoletano\",\"lat\":40.8517091,\"long\":14.270283,\"cluster\":0,\"days\":12},{\"name\":\"La Cantinaccia del Popolo\",\"lat\":40.6275728,\"long\":14.3840332,\"cluster\":8,\"days\":11},{\"name\":\"L'Antica Trattoria\",\"lat\":40.626762,\"long\":14.373122,\"cluster\":8,\"days\":11},{\"name\":\"Rossellinis c\\/o Palazzo Avino\",\"lat\":40.6509636,\"long\":14.6131813,\"cluster\":5,\"days\":10},{\"name\":\"La Zagara\",\"lat\":40.6295968,\"long\":14.4864272,\"cluster\":8,\"days\":11},{\"name\":\"Cafe Positano\",\"lat\":40.6278314,\"long\":14.4851504,\"cluster\":8,\"days\":11},{\"name\":\"Restaurant Zi Ntonio\",\"lat\":40.6266612,\"long\":14.3752132,\"cluster\":8,\"days\":11},{\"name\":\"Torre Normanna (high review, exp)\",\"lat\":40.6440695,\"long\":14.6475589,\"cluster\":5,\"days\":10},{\"name\":\"Le Bont\\u00e0 del Capo\",\"lat\":40.617118,\"long\":14.5679731,\"cluster\":5,\"days\":10},{\"name\":\"Bar del Carmine\",\"lat\":40.6265254,\"long\":14.3765625,\"cluster\":8,\"days\":11},{\"name\":\"Professor Coffee\",\"lat\":40.7858178,\"long\":14.3640114,\"cluster\":0,\"days\":12},{\"name\":\"Hotel Villa Maria - Giordano - Villa Eva\",\"lat\":40.646778,\"long\":14.6103707,\"cluster\":5,\"days\":10},{\"name\":\"Villa Cimbrone\",\"lat\":40.6442298,\"long\":14.6111347,\"cluster\":5,\"days\":10},{\"name\":\"Villa Rufolo\",\"lat\":40.6490049,\"long\":14.6120824,\"cluster\":5,\"days\":10},{\"name\":\"Enotavola Wine Bar\",\"lat\":40.6499741,\"long\":14.6110118,\"cluster\":5,\"days\":10},{\"name\":\"Baffone Gelateria Artigianale\",\"lat\":40.650581,\"long\":14.611408,\"cluster\":5,\"days\":10},{\"name\":\"Villa Comunale\",\"lat\":40.6280369,\"long\":14.3736448,\"cluster\":8,\"days\":11},{\"name\":\"Chiostro di San Francesco\",\"lat\":40.6279257,\"long\":14.3731768,\"cluster\":8,\"days\":11},{\"name\":\"Vallone dei Mulini\",\"lat\":40.6251943,\"long\":14.3763714,\"cluster\":8,\"days\":11},{\"name\":\"Villa Rufolo\",\"lat\":40.6490049,\"long\":14.6120824,\"cluster\":5,\"days\":10},{\"name\":\"Villa Cimbrone\",\"lat\":40.6442298,\"long\":14.6111347,\"cluster\":5,\"days\":10},{\"name\":\"Terrazza dell'Infinito\",\"lat\":40.6427723,\"long\":14.6103727,\"cluster\":5,\"days\":10},{\"name\":\"Ravello Cathedral\",\"lat\":40.6493387,\"long\":14.6119318,\"cluster\":5,\"days\":10},{\"name\":\"Church of Saint John the Apostle of the Toro\",\"lat\":40.6514483,\"long\":14.6126257,\"cluster\":5,\"days\":10}]\n",
"\n",
" var latlng = new google.maps.LatLng(37.99398914736844, 20.80448787105263);\n",
"\n",
" var mapOptions = {\n",
" zoom: 6,\n",
" center: latlng,\n",
" mapTypeId: google.maps.MapTypeId.TERRAIN\n",
" };\n",
"\n",
" map = new google.maps.Map(document.getElementById(\"map\"), mapOptions);\n",
"\n",
" var createMarker = function (info){\n",
" var marker = new google.maps.Marker({\n",
" map: map,\n",
" position: new google.maps.LatLng(info.lat, info.long),\n",
" title: info.name,\n",
" label: info.days.toString()\n",
" });\n",
"\n",
" var infowindow = new google.maps.InfoWindow({\n",
" content: info.name + \" (Day: \"+info.days+\")\"\n",
" });\n",
" marker.addListener('click', function() {\n",
" infowindow.open(map, marker);\n",
" });\n",
" };\n",
"\n",
" for (i = 0; i < markers.length; i++){\n",
" createMarker(markers[i]);\n",
" }\n",
"\n",
"</script>\n"
],
"text/plain": [
"<IPython.core.display.HTML object>"
]
},
"metadata": {
"tags": []
},
"execution_count": 9
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "6oSBjnLrecw2",
"colab_type": "code",
"cellView": "form",
"outputId": "79180a01-b1a0-48e2-a0de-b1713b309da4",
"colab": {
"base_uri": "https://localhost:8080/",
"height": 1000
}
},
"source": [
"#@title List places by day\n",
"pd.set_option('display.max_rows', None)\n",
"places.sort_values(by=['days'])"
],
"execution_count": 10,
"outputs": [
{
"output_type": "execute_result",
"data": {
"text/html": [
"<div>\n",
"<style scoped>\n",
" .dataframe tbody tr th:only-of-type {\n",
" vertical-align: middle;\n",
" }\n",
"\n",
" .dataframe tbody tr th {\n",
" vertical-align: top;\n",
" }\n",
"\n",
" .dataframe thead th {\n",
" text-align: right;\n",
" }\n",
"</style>\n",
"<table border=\"1\" class=\"dataframe\">\n",
" <thead>\n",
" <tr style=\"text-align: right;\">\n",
" <th></th>\n",
" <th>name</th>\n",
" <th>lat</th>\n",
" <th>long</th>\n",
" <th>cluster</th>\n",
" <th>days</th>\n",
" </tr>\n",
" </thead>\n",
" <tbody>\n",
" <tr>\n",
" <th>0</th>\n",
" <td>Athens International Airport</td>\n",
" <td>37.935647</td>\n",
" <td>23.948416</td>\n",
" <td>2</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>12</th>\n",
" <td>Acropolis of Athens</td>\n",
" <td>37.971532</td>\n",
" <td>23.725749</td>\n",
" <td>2</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>11</th>\n",
" <td>Pl. Agias Irinis 2</td>\n",
" <td>37.977418</td>\n",
" <td>23.728022</td>\n",
" <td>2</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>10</th>\n",
" <td>Diporto - Secret underground restaurant</td>\n",
" <td>37.980662</td>\n",
" <td>23.725769</td>\n",
" <td>2</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>9</th>\n",
" <td>Temple of Zeus</td>\n",
" <td>37.969284</td>\n",
" <td>23.733101</td>\n",
" <td>2</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>8</th>\n",
" <td>Plaka</td>\n",
" <td>37.972553</td>\n",
" <td>23.730336</td>\n",
" <td>2</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>7</th>\n",
" <td>Temple of Olympian Zeus</td>\n",
" <td>37.969300</td>\n",
" <td>23.733100</td>\n",
" <td>2</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>31</th>\n",
" <td>Lake Vouliagmeni</td>\n",
" <td>37.807800</td>\n",
" <td>23.785502</td>\n",
" <td>2</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>5</th>\n",
" <td>Parthenon</td>\n",
" <td>37.971528</td>\n",
" <td>23.726717</td>\n",
" <td>2</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>4</th>\n",
" <td>Theatre of Dionysus</td>\n",
" <td>37.970366</td>\n",
" <td>23.727855</td>\n",
" <td>2</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>3</th>\n",
" <td>Roman Forum</td>\n",
" <td>37.974375</td>\n",
" <td>23.725544</td>\n",
" <td>2</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>2</th>\n",
" <td>Tzistarakis Mosque</td>\n",
" <td>37.975920</td>\n",
" <td>23.726032</td>\n",
" <td>2</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>1</th>\n",
" <td>Ancient Agora of Athens</td>\n",
" <td>37.974651</td>\n",
" <td>23.721972</td>\n",
" <td>2</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>6</th>\n",
" <td>Acropolis Museum</td>\n",
" <td>37.968450</td>\n",
" <td>23.728523</td>\n",
" <td>2</td>\n",
" <td>1</td>\n",
" </tr>\n",
" <tr>\n",
" <th>35</th>\n",
" <td>Byzantine Castle Ruins</td>\n",
" <td>36.460110</td>\n",
" <td>25.372734</td>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>36</th>\n",
" <td>Ammoúdi</td>\n",
" <td>36.458185</td>\n",
" <td>25.371654</td>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>38</th>\n",
" <td>Skaros Rock</td>\n",
" <td>36.432335</td>\n",
" <td>25.418145</td>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>39</th>\n",
" <td>Orthodox Metropolitan Cathedral</td>\n",
" <td>36.416942</td>\n",
" <td>25.431696</td>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>40</th>\n",
" <td>Akrotiri</td>\n",
" <td>36.351795</td>\n",
" <td>25.403447</td>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>43</th>\n",
" <td>Venetsanos Winery</td>\n",
" <td>36.382309</td>\n",
" <td>25.431597</td>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>42</th>\n",
" <td>ArtSpace</td>\n",
" <td>36.386002</td>\n",
" <td>25.460343</td>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>44</th>\n",
" <td>Gavalas Winery</td>\n",
" <td>36.375391</td>\n",
" <td>25.430395</td>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>45</th>\n",
" <td>Perissa Black Sand Beach</td>\n",
" <td>36.353718</td>\n",
" <td>25.473675</td>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>46</th>\n",
" <td>Fira Skala Thiras</td>\n",
" <td>36.418194</td>\n",
" <td>25.427760</td>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>34</th>\n",
" <td>Panagia</td>\n",
" <td>36.462282</td>\n",
" <td>25.403654</td>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>41</th>\n",
" <td>Santo</td>\n",
" <td>36.387564</td>\n",
" <td>25.436746</td>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>47</th>\n",
" <td>Ammoúdi</td>\n",
" <td>36.458185</td>\n",
" <td>25.371654</td>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>37</th>\n",
" <td>Virgin Mary Orthodox Church-Three Bells of Fira</td>\n",
" <td>36.423317</td>\n",
" <td>25.428324</td>\n",
" <td>1</td>\n",
" <td>2</td>\n",
" </tr>\n",
" <tr>\n",
" <th>17</th>\n",
" <td>Heraklion Airport N. Kazantzakis</td>\n",
" <td>35.339580</td>\n",
" <td>25.174748</td>\n",
" <td>6</td>\n",
" <td>3</td>\n",
" </tr>\n",
" <tr>\n",
" <th>21</th>\n",
" <td>Minoan Palace of Knossos</td>\n",
" <td>35.297819</td>\n",
" <td>25.163128</td>\n",
" <td>6</td>\n",
" <td>3</td>\n",
" </tr>\n",
" <tr>\n",
" <th>22</th>\n",
" <td>Heraklion Archaeological Museum</td>\n",
" <td>35.338810</td>\n",
" <td>25.137013</td>\n",
" <td>6</td>\n",
" <td>3</td>\n",
" </tr>\n",
" <tr>\n",
" <th>32</th>\n",
" <td>Windmills of the Lasithi Plateau</td>\n",
" <td>35.204336</td>\n",
" <td>25.454937</td>\n",
" <td>10</td>\n",
" <td>4</td>\n",
" </tr>\n",
" <tr>\n",
" <th>30</th>\n",
" <td>Phaistos Minoan Palace</td>\n",
" <td>35.051455</td>\n",
" <td>24.814546</td>\n",
" <td>9</td>\n",
" <td>5</td>\n",
" </tr>\n",
" <tr>\n",
" <th>28</th>\n",
" <td>Monastery of Arkadi</td>\n",
" <td>35.309877</td>\n",
" <td>24.628943</td>\n",
" <td>3</td>\n",
" <td>6</td>\n",
" </tr>\n",
" <tr>\n",
" <th>13</th>\n",
" <td>Guora Gate</td>\n",
" <td>35.367285</td>\n",
" <td>24.474399</td>\n",
" <td>3</td>\n",
" <td>6</td>\n",
" </tr>\n",
" <tr>\n",
" <th>14</th>\n",
" <td>Fortezza Castle</td>\n",
" <td>35.371982</td>\n",
" <td>24.471120</td>\n",
" <td>3</td>\n",
" <td>6</td>\n",
" </tr>\n",
" <tr>\n",
" <th>15</th>\n",
" <td>Rethimno</td>\n",
" <td>35.364362</td>\n",
" <td>24.482155</td>\n",
" <td>3</td>\n",
" <td>6</td>\n",
" </tr>\n",
" <tr>\n",
" <th>18</th>\n",
" <td>Rimondi Fountain</td>\n",
" <td>35.369965</td>\n",
" <td>24.474640</td>\n",
" <td>3</td>\n",
" <td>6</td>\n",
" </tr>\n",
" <tr>\n",
" <th>25</th>\n",
" <td>Rethymno Apartment Old Town</td>\n",
" <td>35.370969</td>\n",
" <td>24.474725</td>\n",
" <td>3</td>\n",
" <td>6</td>\n",
" </tr>\n",
" <tr>\n",
" <th>24</th>\n",
" <td>Samaria Gorge</td>\n",
" <td>35.240130</td>\n",
" <td>23.961202</td>\n",
" <td>11</td>\n",
" <td>7</td>\n",
" </tr>\n",
" <tr>\n",
" <th>33</th>\n",
" <td>Loutro</td>\n",
" <td>35.200004</td>\n",
" <td>24.078665</td>\n",
" <td>11</td>\n",
" <td>7</td>\n",
" </tr>\n",
" <tr>\n",
" <th>20</th>\n",
" <td>Old Venetian Harbour.</td>\n",
" <td>35.518644</td>\n",
" <td>24.019847</td>\n",
" <td>7</td>\n",
" <td>8</td>\n",
" </tr>\n",
" <tr>\n",
" <th>19</th>\n",
" <td>Venetian house old town Chania</td>\n",
" <td>35.517809</td>\n",
" <td>24.019447</td>\n",
" <td>7</td>\n",
" <td>8</td>\n",
" </tr>\n",
" <tr>\n",
" <th>27</th>\n",
" <td>Old Venetian Harbour.</td>\n",
" <td>35.518644</td>\n",
" <td>24.019847</td>\n",
" <td>7</td>\n",
" <td>8</td>\n",
" </tr>\n",
" <tr>\n",
" <th>16</th>\n",
" <td>Chania</td>\n",
" <td>35.513830</td>\n",
" <td>24.018037</td>\n",
" <td>7</td>\n",
" <td>8</td>\n",
" </tr>\n",
" <tr>\n",
" <th>23</th>\n",
" <td>Elafonissi Beach (world best beach)</td>\n",
" <td>35.271180</td>\n",
" <td>23.541296</td>\n",
" <td>4</td>\n",
" <td>9</td>\n",
" </tr>\n",
" <tr>\n",
" <th>29</th>\n",
" <td>Falassarna Beach</td>\n",
" <td>35.494755</td>\n",
" <td>23.579963</td>\n",
" <td>4</td>\n",
" <td>9</td>\n",
" </tr>\n",
" <tr>\n",
" <th>26</th>\n",
" <td>Balos Lagoon (one of Crete’s most famous images)</td>\n",
" <td>35.581937</td>\n",
" <td>23.588855</td>\n",
" <td>4</td>\n",
" <td>9</td>\n",
" </tr>\n",
" <tr>\n",
" <th>73</th>\n",
" <td>Terrazza dell'Infinito</td>\n",
" <td>40.642772</td>\n",
" <td>14.610373</td>\n",
" <td>5</td>\n",
" <td>10</td>\n",
" </tr>\n",
" <tr>\n",
" <th>72</th>\n",
" <td>Villa Cimbrone</td>\n",
" <td>40.644230</td>\n",
" <td>14.611135</td>\n",
" <td>5</td>\n",
" <td>10</td>\n",
" </tr>\n",
" <tr>\n",
" <th>71</th>\n",
" <td>Villa Rufolo</td>\n",
" <td>40.649005</td>\n",
" <td>14.612082</td>\n",
" <td>5</td>\n",
" <td>10</td>\n",
" </tr>\n",
" <tr>\n",
" <th>67</th>\n",
" <td>Baffone Gelateria Artigianale</td>\n",
" <td>40.650581</td>\n",
" <td>14.611408</td>\n",
" <td>5</td>\n",
" <td>10</td>\n",
" </tr>\n",
" <tr>\n",
" <th>60</th>\n",
" <td>Le Bontà del Capo</td>\n",
" <td>40.617118</td>\n",
" <td>14.567973</td>\n",
" <td>5</td>\n",
" <td>10</td>\n",
" </tr>\n",
" <tr>\n",
" <th>66</th>\n",
" <td>Enotavola Wine Bar</td>\n",
" <td>40.649974</td>\n",
" <td>14.611012</td>\n",
" <td>5</td>\n",
" <td>10</td>\n",
" </tr>\n",
" <tr>\n",
" <th>65</th>\n",
" <td>Villa Rufolo</td>\n",
" <td>40.649005</td>\n",
" <td>14.612082</td>\n",
" <td>5</td>\n",
" <td>10</td>\n",
" </tr>\n",
" <tr>\n",
" <th>64</th>\n",
" <td>Villa Cimbrone</td>\n",
" <td>40.644230</td>\n",
" <td>14.611135</td>\n",
" <td>5</td>\n",
" <td>10</td>\n",
" </tr>\n",
" <tr>\n",
" <th>63</th>\n",
" <td>Hotel Villa Maria - Giordano - Villa Eva</td>\n",
" <td>40.646778</td>\n",
" <td>14.610371</td>\n",
" <td>5</td>\n",
" <td>10</td>\n",
" </tr>\n",
" <tr>\n",
" <th>59</th>\n",
" <td>Torre Normanna (high review, exp)</td>\n",
" <td>40.644070</td>\n",
" <td>14.647559</td>\n",
" <td>5</td>\n",
" <td>10</td>\n",
" </tr>\n",
" <tr>\n",
" <th>75</th>\n",
" <td>Church of Saint John the Apostle of the Toro</td>\n",
" <td>40.651448</td>\n",
" <td>14.612626</td>\n",
" <td>5</td>\n",
" <td>10</td>\n",
" </tr>\n",
" <tr>\n",
" <th>74</th>\n",
" <td>Ravello Cathedral</td>\n",
" <td>40.649339</td>\n",
" <td>14.611932</td>\n",
" <td>5</td>\n",
" <td>10</td>\n",
" </tr>\n",
" <tr>\n",
" <th>55</th>\n",
" <td>Rossellinis c/o Palazzo Avino</td>\n",
" <td>40.650964</td>\n",
" <td>14.613181</td>\n",
" <td>5</td>\n",
" <td>10</td>\n",
" </tr>\n",
" <tr>\n",
" <th>57</th>\n",
" <td>Cafe Positano</td>\n",
" <td>40.627831</td>\n",
" <td>14.485150</td>\n",
" <td>8</td>\n",
" <td>11</td>\n",
" </tr>\n",
" <tr>\n",
" <th>56</th>\n",
" <td>La Zagara</td>\n",
" <td>40.629597</td>\n",
" <td>14.486427</td>\n",
" <td>8</td>\n",
" <td>11</td>\n",
" </tr>\n",
" <tr>\n",
" <th>61</th>\n",
" <td>Bar del Carmine</td>\n",
" <td>40.626525</td>\n",
" <td>14.376563</td>\n",
" <td>8</td>\n",
" <td>11</td>\n",
" </tr>\n",
" <tr>\n",
" <th>54</th>\n",
" <td>L'Antica Trattoria</td>\n",
" <td>40.626762</td>\n",
" <td>14.373122</td>\n",
" <td>8</td>\n",
" <td>11</td>\n",
" </tr>\n",
" <tr>\n",
" <th>53</th>\n",
" <td>La Cantinaccia del Popolo</td>\n",
" <td>40.627573</td>\n",
" <td>14.384033</td>\n",
" <td>8</td>\n",
" <td>11</td>\n",
" </tr>\n",
" <tr>\n",
" <th>58</th>\n",
" <td>Restaurant Zi Ntonio</td>\n",
" <td>40.626661</td>\n",
" <td>14.375213</td>\n",
" <td>8</td>\n",
" <td>11</td>\n",
" </tr>\n",
" <tr>\n",
" <th>68</th>\n",
" <td>Villa Comunale</td>\n",
" <td>40.628037</td>\n",
" <td>14.373645</td>\n",
" <td>8</td>\n",
" <td>11</td>\n",
" </tr>\n",
" <tr>\n",
" <th>69</th>\n",
" <td>Chiostro di San Francesco</td>\n",
" <td>40.627926</td>\n",
" <td>14.373177</td>\n",
" <td>8</td>\n",
" <td>11</td>\n",
" </tr>\n",
" <tr>\n",
" <th>70</th>\n",
" <td>Vallone dei Mulini</td>\n",
" <td>40.625194</td>\n",
" <td>14.376371</td>\n",
" <td>8</td>\n",
" <td>11</td>\n",
" </tr>\n",
" <tr>\n",
" <th>48</th>\n",
" <td>Gino e Toto Sorbillo (best pizza)</td>\n",
" <td>40.850413</td>\n",
" <td>14.255318</td>\n",
" <td>0</td>\n",
" <td>12</td>\n",
" </tr>\n",
" <tr>\n",
" <th>50</th>\n",
" <td>Starita (best pizza)</td>\n",
" <td>40.855923</td>\n",
" <td>14.246381</td>\n",
" <td>0</td>\n",
" <td>12</td>\n",
" </tr>\n",
" <tr>\n",
" <th>52</th>\n",
" <td>Attanasio - Ristorante tipico napoletano</td>\n",
" <td>40.851709</td>\n",
" <td>14.270283</td>\n",
" <td>0</td>\n",
" <td>12</td>\n",
" </tr>\n",
" <tr>\n",
" <th>62</th>\n",
" <td>Professor Coffee</td>\n",
" <td>40.785818</td>\n",
" <td>14.364011</td>\n",
" <td>0</td>\n",
" <td>12</td>\n",
" </tr>\n",
" <tr>\n",
" <th>49</th>\n",
" <td>Naples International Airport</td>\n",
" <td>40.884749</td>\n",
" <td>14.289243</td>\n",
" <td>0</td>\n",
" <td>12</td>\n",
" </tr>\n",
" <tr>\n",
" <th>51</th>\n",
" <td>L'Antica Pizzeria da Michele (really best pizza)</td>\n",
" <td>40.849756</td>\n",
" <td>14.263300</td>\n",
" <td>0</td>\n",
" <td>12</td>\n",
" </tr>\n",
" </tbody>\n",
"</table>\n",
"</div>"
],
"text/plain": [
" name lat ... cluster days\n",
"0 Athens International Airport 37.935647 ... 2 1\n",
"12 Acropolis of Athens 37.971532 ... 2 1\n",
"11 Pl. Agias Irinis 2 37.977418 ... 2 1\n",
"10 Diporto - Secret underground restaurant 37.980662 ... 2 1\n",
"9 Temple of Zeus 37.969284 ... 2 1\n",
"8 Plaka 37.972553 ... 2 1\n",
"7 Temple of Olympian Zeus 37.969300 ... 2 1\n",
"31 Lake Vouliagmeni 37.807800 ... 2 1\n",
"5 Parthenon 37.971528 ... 2 1\n",
"4 Theatre of Dionysus 37.970366 ... 2 1\n",
"3 Roman Forum 37.974375 ... 2 1\n",
"2 Tzistarakis Mosque 37.975920 ... 2 1\n",
"1 Ancient Agora of Athens 37.974651 ... 2 1\n",
"6 Acropolis Museum 37.968450 ... 2 1\n",
"35 Byzantine Castle Ruins 36.460110 ... 1 2\n",
"36 Ammoúdi 36.458185 ... 1 2\n",
"38 Skaros Rock 36.432335 ... 1 2\n",
"39 Orthodox Metropolitan Cathedral 36.416942 ... 1 2\n",
"40 Akrotiri 36.351795 ... 1 2\n",
"43 Venetsanos Winery 36.382309 ... 1 2\n",
"42 ArtSpace 36.386002 ... 1 2\n",
"44 Gavalas Winery 36.375391 ... 1 2\n",
"45 Perissa Black Sand Beach 36.353718 ... 1 2\n",
"46 Fira Skala Thiras 36.418194 ... 1 2\n",
"34 Panagia 36.462282 ... 1 2\n",
"41 Santo 36.387564 ... 1 2\n",
"47 Ammoúdi 36.458185 ... 1 2\n",
"37 Virgin Mary Orthodox Church-Three Bells of Fira 36.423317 ... 1 2\n",
"17 Heraklion Airport N. Kazantzakis 35.339580 ... 6 3\n",
"21 Minoan Palace of Knossos 35.297819 ... 6 3\n",
"22 Heraklion Archaeological Museum 35.338810 ... 6 3\n",
"32 Windmills of the Lasithi Plateau 35.204336 ... 10 4\n",
"30 Phaistos Minoan Palace 35.051455 ... 9 5\n",
"28 Monastery of Arkadi 35.309877 ... 3 6\n",
"13 Guora Gate 35.367285 ... 3 6\n",
"14 Fortezza Castle 35.371982 ... 3 6\n",
"15 Rethimno 35.364362 ... 3 6\n",
"18 Rimondi Fountain 35.369965 ... 3 6\n",
"25 Rethymno Apartment Old Town 35.370969 ... 3 6\n",
"24 Samaria Gorge 35.240130 ... 11 7\n",
"33 Loutro 35.200004 ... 11 7\n",
"20 Old Venetian Harbour. 35.518644 ... 7 8\n",
"19 Venetian house old town Chania 35.517809 ... 7 8\n",
"27 Old Venetian Harbour. 35.518644 ... 7 8\n",
"16 Chania 35.513830 ... 7 8\n",
"23 Elafonissi Beach (world best beach) 35.271180 ... 4 9\n",
"29 Falassarna Beach 35.494755 ... 4 9\n",
"26 Balos Lagoon (one of Crete’s most famous images) 35.581937 ... 4 9\n",
"73 Terrazza dell'Infinito 40.642772 ... 5 10\n",
"72 Villa Cimbrone 40.644230 ... 5 10\n",
"71 Villa Rufolo 40.649005 ... 5 10\n",
"67 Baffone Gelateria Artigianale 40.650581 ... 5 10\n",
"60 Le Bontà del Capo 40.617118 ... 5 10\n",
"66 Enotavola Wine Bar 40.649974 ... 5 10\n",
"65 Villa Rufolo 40.649005 ... 5 10\n",
"64 Villa Cimbrone 40.644230 ... 5 10\n",
"63 Hotel Villa Maria - Giordano - Villa Eva 40.646778 ... 5 10\n",
"59 Torre Normanna (high review, exp) 40.644070 ... 5 10\n",
"75 Church of Saint John the Apostle of the Toro 40.651448 ... 5 10\n",
"74 Ravello Cathedral 40.649339 ... 5 10\n",
"55 Rossellinis c/o Palazzo Avino 40.650964 ... 5 10\n",
"57 Cafe Positano 40.627831 ... 8 11\n",
"56 La Zagara 40.629597 ... 8 11\n",
"61 Bar del Carmine 40.626525 ... 8 11\n",
"54 L'Antica Trattoria 40.626762 ... 8 11\n",
"53 La Cantinaccia del Popolo 40.627573 ... 8 11\n",
"58 Restaurant Zi Ntonio 40.626661 ... 8 11\n",
"68 Villa Comunale 40.628037 ... 8 11\n",
"69 Chiostro di San Francesco 40.627926 ... 8 11\n",
"70 Vallone dei Mulini 40.625194 ... 8 11\n",
"48 Gino e Toto Sorbillo (best pizza) 40.850413 ... 0 12\n",
"50 Starita (best pizza) 40.855923 ... 0 12\n",
"52 Attanasio - Ristorante tipico napoletano 40.851709 ... 0 12\n",
"62 Professor Coffee 40.785818 ... 0 12\n",
"49 Naples International Airport 40.884749 ... 0 12\n",
"51 L'Antica Pizzeria da Michele (really best pizza) 40.849756 ... 0 12\n",
"\n",
"[76 rows x 5 columns]"
]
},
"metadata": {
"tags": []
},
"execution_count": 10
}
]
},
{
"cell_type": "code",
"metadata": {
"id": "sRlZE-j8mXT8",
"colab_type": "code",
"colab": {}
},
"source": [
""
],
"execution_count": 0,
"outputs": []
}
]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment