{ "cells": [ { "cell_type": "code", "execution_count": 78, "id": "initial_id", "metadata": { "collapsed": true, "ExecuteTime": { "end_time": "2023-11-06T01:14:10.536728Z", "start_time": "2023-11-06T01:14:10.525881Z" } }, "outputs": [], "source": [ "import folium\n", "import matplotlib.pyplot as plt\n", "import numpy as np\n", "import pandas as pd\n", "from scipy.cluster.hierarchy import dendrogram, linkage\n", "from scipy.cluster.hierarchy import fcluster\n", "from sklearn.metrics import silhouette_score\n", "from sklearn.cluster import KMeans\n", "import utils" ] }, { "cell_type": "code", "execution_count": 79, "outputs": [], "source": [ "# Load the data\n", "ListA = pd.read_csv('List A.csv')\n", "ListB = pd.read_csv('List B.csv')\n", "ListC = pd.read_csv('List C.csv')\n", "ListD = pd.read_csv('List D.csv')" ], "metadata": { "collapsed": false, "ExecuteTime": { "end_time": "2023-11-06T01:14:10.821794Z", "start_time": "2023-11-06T01:14:10.808507Z" } }, "id": "bb6f57eef695cf76" }, { "cell_type": "code", "execution_count": 80, "outputs": [ { "data": { "text/plain": " name gps \\\n0 521 Commercial Street #525 42.3688272,-71.0553792 \n1 Acorn St 42.3576234,-71.0688746 \n2 Arlington's Great Meadows 42.4299758,-71.2038948 \n3 Arthur Fiedler Statue 42.3565057,-71.0754527 \n4 BU Beach 42.3511927,-71.1060828 \n.. ... ... \n28 The Clam Box 42.2763168,-71.0092883 \n29 The Partisans 42.3478375,-71.0404428 \n30 Union Oyster House 42.361288,-71.056908 \n31 Victoria's Diner 42.3270498,-71.0667744 \n32 Wollaston Beach 42.2806539,-71.0119933 \n\n googleUrl \\\n0 https://maps.google.com/maps?q=+%4042.3688272,... \n1 https://maps.google.com/maps?q=+%4042.3576234,... \n2 https://maps.google.com/maps?q=+%4042.4299758,... \n3 https://maps.google.com/maps?q=+%4042.3565057,... \n4 https://maps.google.com/maps?q=+%4042.3511927,... \n.. ... \n28 https://maps.google.com/maps?q=+%4042.2763168,... \n29 https://maps.google.com/maps?q=+%4042.3478375,... \n30 https://maps.google.com/maps?q=+%4042.361288,-... \n31 https://maps.google.com/maps?q=+%4042.3270498,... \n32 https://maps.google.com/maps?q=+%4042.2806539,... \n\n originalUrl info types \\\n0 https://www.google.com/maps/place/521+Commerci... NaN NaN \n1 https://www.google.com/maps/place/Acorn+St/dat... NaN NaN \n2 https://www.google.com/maps/place/Arlington's+... NaN NaN \n3 https://www.google.com/maps/place/Arthur+Fiedl... NaN NaN \n4 https://www.google.com/maps/place/BU+Beach/dat... NaN NaN \n.. ... ... ... \n28 https://www.google.com/maps/place/The+Clam+Box... NaN NaN \n29 https://www.google.com/maps/place/The+Partisan... NaN NaN \n30 https://www.google.com/maps/place/Union+Oyster... NaN NaN \n31 https://www.google.com/maps/place/Victoria's+D... NaN NaN \n32 https://www.google.com/maps/place/Wollaston+Be... NaN NaN \n\n address \\\n0 NaN \n1 NaN \n2 Minuteman Commuter Bikeway, Lexington, MA 0242... \n3 Charles River Esplanades, Boston, MA 02114, Un... \n4 270 Bay State Rd, Boston, MA 02215, United States \n.. ... \n28 789 Quincy Shore Dr, Quincy, MA 02170, United ... \n29 Boston, MA 02210, United States \n30 41 Union St, Boston, MA 02108, United States \n31 1024 Massachusetts Ave, Boston, MA 02118, Unit... \n32 Quincy, MA, United States \n\n description type \\\n0 NaN NaN \n1 NaN NaN \n2 183-acres of wet meadows & uplands with trails... Nature preserve \n3 NaN Sculpture \n4 A sloping, grassy plaza on the university grou... Park \n.. ... ... \n28 Classic beachfront joint with a rustic vibe di... Seafood restaurant \n29 NaN Sculpture \n30 Historic eatery serving chowder & other New En... Seafood restaurant \n31 Long-standing classic diner for breakfast & sa... Diner \n32 Historic 2.3-mi.-long beach with a paved prome... Beach \n\n phone website \\\n0 NaN NaN \n1 NaN NaN \n2 +1 781-863-5385 http://www.foagm.org/ \n3 +1 617-332-2433 http://helmicksculpture.com/portfolio/arthur-f... \n4 NaN https://www.bu.edu/today/2009/icons-among-us-t... \n.. ... ... \n28 +1 617-302-3474 http://www.clamboxquincy.com/ \n29 NaN https://www.bostonseaport.xyz/venue/the-partis... \n30 +1 617-227-2750 http://www.unionoysterhouse.com/?y_source=1_Mj... \n31 +1 617-442-5965 http://www.victoriasdiner.com/ \n32 NaN NaN \n\n ratingsAverage ratingsTotal plusCode list \n0 NaN NaN NaN A \n1 NaN NaN NaN A \n2 4.6 171.0 CQHW+XC Lexington, Massachusetts, USA A \n3 4.6 14.0 9W4F+JR Boston, Massachusetts, USA A \n4 4.5 133.0 9V2V+FH Boston, Massachusetts, USA A \n.. ... ... ... ... \n28 4.3 2145.0 7XGR+G7 Quincy, Massachusetts, USA C \n29 4.8 6.0 8XX5+4R Boston, Massachusetts, USA C \n30 4.3 8497.0 9W6V+G6 Boston, Massachusetts, USA C \n31 4.1 1797.0 8WGM+R7 Boston, Massachusetts, USA C \n32 4.4 171.0 NaN C \n\n[131 rows x 15 columns]", "text/html": "
| \n | name | \ngps | \ngoogleUrl | \noriginalUrl | \ninfo | \ntypes | \naddress | \ndescription | \ntype | \nphone | \nwebsite | \nratingsAverage | \nratingsTotal | \nplusCode | \nlist | \n
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | \n521 Commercial Street #525 | \n42.3688272,-71.0553792 | \nhttps://maps.google.com/maps?q=+%4042.3688272,... | \nhttps://www.google.com/maps/place/521+Commerci... | \nNaN | \nNaN | \nNaN | \nNaN | \nNaN | \nNaN | \nNaN | \nNaN | \nNaN | \nNaN | \nA | \n
| 1 | \nAcorn St | \n42.3576234,-71.0688746 | \nhttps://maps.google.com/maps?q=+%4042.3576234,... | \nhttps://www.google.com/maps/place/Acorn+St/dat... | \nNaN | \nNaN | \nNaN | \nNaN | \nNaN | \nNaN | \nNaN | \nNaN | \nNaN | \nNaN | \nA | \n
| 2 | \nArlington's Great Meadows | \n42.4299758,-71.2038948 | \nhttps://maps.google.com/maps?q=+%4042.4299758,... | \nhttps://www.google.com/maps/place/Arlington's+... | \nNaN | \nNaN | \nMinuteman Commuter Bikeway, Lexington, MA 0242... | \n183-acres of wet meadows & uplands with trails... | \nNature preserve | \n+1 781-863-5385 | \nhttp://www.foagm.org/ | \n4.6 | \n171.0 | \nCQHW+XC Lexington, Massachusetts, USA | \nA | \n
| 3 | \nArthur Fiedler Statue | \n42.3565057,-71.0754527 | \nhttps://maps.google.com/maps?q=+%4042.3565057,... | \nhttps://www.google.com/maps/place/Arthur+Fiedl... | \nNaN | \nNaN | \nCharles River Esplanades, Boston, MA 02114, Un... | \nNaN | \nSculpture | \n+1 617-332-2433 | \nhttp://helmicksculpture.com/portfolio/arthur-f... | \n4.6 | \n14.0 | \n9W4F+JR Boston, Massachusetts, USA | \nA | \n
| 4 | \nBU Beach | \n42.3511927,-71.1060828 | \nhttps://maps.google.com/maps?q=+%4042.3511927,... | \nhttps://www.google.com/maps/place/BU+Beach/dat... | \nNaN | \nNaN | \n270 Bay State Rd, Boston, MA 02215, United States | \nA sloping, grassy plaza on the university grou... | \nPark | \nNaN | \nhttps://www.bu.edu/today/2009/icons-among-us-t... | \n4.5 | \n133.0 | \n9V2V+FH Boston, Massachusetts, USA | \nA | \n
| ... | \n... | \n... | \n... | \n... | \n... | \n... | \n... | \n... | \n... | \n... | \n... | \n... | \n... | \n... | \n... | \n
| 28 | \nThe Clam Box | \n42.2763168,-71.0092883 | \nhttps://maps.google.com/maps?q=+%4042.2763168,... | \nhttps://www.google.com/maps/place/The+Clam+Box... | \nNaN | \nNaN | \n789 Quincy Shore Dr, Quincy, MA 02170, United ... | \nClassic beachfront joint with a rustic vibe di... | \nSeafood restaurant | \n+1 617-302-3474 | \nhttp://www.clamboxquincy.com/ | \n4.3 | \n2145.0 | \n7XGR+G7 Quincy, Massachusetts, USA | \nC | \n
| 29 | \nThe Partisans | \n42.3478375,-71.0404428 | \nhttps://maps.google.com/maps?q=+%4042.3478375,... | \nhttps://www.google.com/maps/place/The+Partisan... | \nNaN | \nNaN | \nBoston, MA 02210, United States | \nNaN | \nSculpture | \nNaN | \nhttps://www.bostonseaport.xyz/venue/the-partis... | \n4.8 | \n6.0 | \n8XX5+4R Boston, Massachusetts, USA | \nC | \n
| 30 | \nUnion Oyster House | \n42.361288,-71.056908 | \nhttps://maps.google.com/maps?q=+%4042.361288,-... | \nhttps://www.google.com/maps/place/Union+Oyster... | \nNaN | \nNaN | \n41 Union St, Boston, MA 02108, United States | \nHistoric eatery serving chowder & other New En... | \nSeafood restaurant | \n+1 617-227-2750 | \nhttp://www.unionoysterhouse.com/?y_source=1_Mj... | \n4.3 | \n8497.0 | \n9W6V+G6 Boston, Massachusetts, USA | \nC | \n
| 31 | \nVictoria's Diner | \n42.3270498,-71.0667744 | \nhttps://maps.google.com/maps?q=+%4042.3270498,... | \nhttps://www.google.com/maps/place/Victoria's+D... | \nNaN | \nNaN | \n1024 Massachusetts Ave, Boston, MA 02118, Unit... | \nLong-standing classic diner for breakfast & sa... | \nDiner | \n+1 617-442-5965 | \nhttp://www.victoriasdiner.com/ | \n4.1 | \n1797.0 | \n8WGM+R7 Boston, Massachusetts, USA | \nC | \n
| 32 | \nWollaston Beach | \n42.2806539,-71.0119933 | \nhttps://maps.google.com/maps?q=+%4042.2806539,... | \nhttps://www.google.com/maps/place/Wollaston+Be... | \nNaN | \nNaN | \nQuincy, MA, United States | \nHistoric 2.3-mi.-long beach with a paved prome... | \nBeach | \nNaN | \nNaN | \n4.4 | \n171.0 | \nNaN | \nC | \n
131 rows × 15 columns
\n| \n | name | \ngps | \nlist | \n
|---|---|---|---|
| 0 | \n521 Commercial Street #525 | \n[42.3688272, -71.0553792] | \nA | \n
| 1 | \nAcorn St | \n[42.3576234, -71.0688746] | \nA | \n
| 2 | \nArlington's Great Meadows | \n[42.4299758, -71.2038948] | \nA | \n
| 3 | \nArthur Fiedler Statue | \n[42.3565057, -71.0754527] | \nA | \n
| 4 | \nBU Beach | \n[42.3511927, -71.1060828] | \nA | \n
| ... | \n... | \n... | \n... | \n
| 28 | \nThe Clam Box | \n[42.2763168, -71.0092883] | \nC | \n
| 29 | \nThe Partisans | \n[42.3478375, -71.0404428] | \nC | \n
| 30 | \nUnion Oyster House | \n[42.361288, -71.056908] | \nC | \n
| 31 | \nVictoria's Diner | \n[42.3270498, -71.0667744] | \nC | \n
| 32 | \nWollaston Beach | \n[42.2806539, -71.0119933] | \nC | \n
131 rows × 3 columns
\n| \n | name | \ngps | \nlist | \nweights | \n
|---|---|---|---|---|
| 0 | \n521 Commercial Street #525 | \n[42.3688272, -71.0553792] | \nA | \n0.018132 | \n
| 1 | \nAcorn St | \n[42.3576234, -71.0688746] | \nA | \n0.008032 | \n
| 2 | \nArlington's Great Meadows | \n[42.4299758, -71.2038948] | \nA | \n0.000676 | \n
| 3 | \nArthur Fiedler Statue | \n[42.3565057, -71.0754527] | \nA | \n0.005410 | \n
| 4 | \nBU Beach | \n[42.3511927, -71.1060828] | \nA | \n0.002145 | \n
| ... | \n... | \n... | \n... | \n... | \n
| 28 | \nThe Clam Box | \n[42.2763168, -71.0092883] | \nC | \n0.001136 | \n
| 29 | \nThe Partisans | \n[42.3478375, -71.0404428] | \nC | \n0.005315 | \n
| 30 | \nUnion Oyster House | \n[42.361288, -71.056908] | \nC | \n0.037200 | \n
| 31 | \nVictoria's Diner | \n[42.3270498, -71.0667744] | \nC | \n0.003055 | \n
| 32 | \nWollaston Beach | \n[42.2806539, -71.0119933] | \nC | \n0.001198 | \n
131 rows × 4 columns
\n| \n | name | \ngps | \nlist | \nweights | \ncluster | \n
|---|---|---|---|---|---|
| 0 | \n521 Commercial Street #525 | \n[42.3688272, -71.0553792] | \nA | \n0.018132 | \n1 | \n
| 1 | \nAcorn St | \n[42.3576234, -71.0688746] | \nA | \n0.008032 | \n1 | \n
| 2 | \nArlington's Great Meadows | \n[42.4299758, -71.2038948] | \nA | \n0.000676 | \n0 | \n
| 3 | \nArthur Fiedler Statue | \n[42.3565057, -71.0754527] | \nA | \n0.005410 | \n1 | \n
| 4 | \nBU Beach | \n[42.3511927, -71.1060828] | \nA | \n0.002145 | \n0 | \n
| ... | \n... | \n... | \n... | \n... | \n... | \n
| 28 | \nThe Clam Box | \n[42.2763168, -71.0092883] | \nC | \n0.001136 | \n1 | \n
| 29 | \nThe Partisans | \n[42.3478375, -71.0404428] | \nC | \n0.005315 | \n1 | \n
| 30 | \nUnion Oyster House | \n[42.361288, -71.056908] | \nC | \n0.037200 | \n1 | \n
| 31 | \nVictoria's Diner | \n[42.3270498, -71.0667744] | \nC | \n0.003055 | \n1 | \n
| 32 | \nWollaston Beach | \n[42.2806539, -71.0119933] | \nC | \n0.001198 | \n1 | \n
131 rows × 5 columns
\n