From feb047071ab7f7a688d2f3925d07d757b4b37d7d Mon Sep 17 00:00:00 2001 From: itsGarrin Date: Tue, 5 Nov 2024 15:41:24 -0500 Subject: hi --- ZestySalesman.ipynb | 235 +++++++++++++++++++++++++++++++--------------------- utils.py | 23 +++-- 2 files changed, 155 insertions(+), 103 deletions(-) diff --git a/ZestySalesman.ipynb b/ZestySalesman.ipynb index 60dd19e..8e4372c 100644 --- a/ZestySalesman.ipynb +++ b/ZestySalesman.ipynb @@ -2,70 +2,68 @@ "cells": [ { "cell_type": "code", - "execution_count": 1, "id": "initial_id", "metadata": { + "collapsed": true, "ExecuteTime": { - "end_time": "2023-11-07T23:05:35.179983Z", - "start_time": "2023-11-07T23:05:34.039783Z" - }, - "collapsed": true + "end_time": "2024-07-02T22:37:51.219877Z", + "start_time": "2024-07-02T22:37:50.303317Z" + } }, - "outputs": [], "source": [ "import pandas as pd\n", "import folium\n", "import utils" - ] + ], + "outputs": [], + "execution_count": 1 }, { "cell_type": "code", - "execution_count": 2, "id": "73b780e762c9de37", "metadata": { "ExecuteTime": { - "end_time": "2023-11-07T23:05:35.194166Z", - "start_time": "2023-11-07T23:05:35.181233Z" + "end_time": "2024-07-02T22:37:51.229897Z", + "start_time": "2024-07-02T22:37:51.220757Z" } }, - "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')" - ] + ], + "outputs": [], + "execution_count": 2 }, { "cell_type": "code", - "execution_count": 3, "id": "be4c8c1d77842ef7", "metadata": { "ExecuteTime": { - "end_time": "2023-11-07T23:05:35.195314Z", - "start_time": "2023-11-07T23:05:35.193156Z" + "end_time": "2024-07-02T22:37:51.231873Z", + "start_time": "2024-07-02T22:37:51.230471Z" } }, - "outputs": [], "source": [ "# Create two centroids, one in the North End and one in the Seaport District\n", "centroids = [[42.365, -71.054], [42.351, -71.045]]\n", "\n", "northeastern_coordinate = \"-71.09033,42.33976\"" - ] + ], + "outputs": [], + "execution_count": 3 }, { "cell_type": "code", - "execution_count": 4, "id": "ffe4025e97a6c6b9", "metadata": { "ExecuteTime": { - "end_time": "2023-11-07T23:05:35.201800Z", - "start_time": "2023-11-07T23:05:35.197747Z" + "end_time": "2024-07-02T22:37:51.235758Z", + "start_time": "2024-07-02T22:37:51.232888Z" } }, - "outputs": [], "source": [ "# Combine the two lists and add a column to indicate the list\n", "ListA['list'] = 'A'\n", @@ -73,55 +71,76 @@ "ListC['list'] = 'C'\n", "ListD['list'] = 'D'\n", "\n", - "TotalList = pd.concat([ListA, ListB, ListC, ListD])" - ] + "#TotalList = pd.concat([ListA, ListB, ListC, ListD])\n", + "TotalList = pd.concat([ListA, ListB])" + ], + "outputs": [], + "execution_count": 4 }, { "cell_type": "code", - "execution_count": 5, "id": "72657779b4484aae", "metadata": { "ExecuteTime": { - "end_time": "2023-11-07T23:05:35.215762Z", - "start_time": "2023-11-07T23:05:35.200811Z" + "end_time": "2024-07-02T22:37:51.238164Z", + "start_time": "2024-07-02T22:37:51.236334Z" } }, - "outputs": [], "source": [ "# Remove all columns but name and gps\n", "TotalList = TotalList[['name', 'gps', 'list']]" - ] + ], + "outputs": [], + "execution_count": 5 }, { "cell_type": "code", - "execution_count": 6, "id": "a157ffaec020a29a", "metadata": { "ExecuteTime": { - "end_time": "2023-11-07T23:05:35.215916Z", - "start_time": "2023-11-07T23:05:35.204173Z" + "end_time": "2024-07-02T22:37:51.356176Z", + "start_time": "2024-07-02T22:37:51.353712Z" } }, - "outputs": [], "source": [ "# Convert the gps column to a list of lists for k-means\n", "TotalList['gps'] = TotalList['gps'].apply(lambda x: x.strip('[]').split(','))\n", "TotalList['gps'] = TotalList['gps'].apply(lambda x: [float(i) for i in x])" - ] + ], + "outputs": [], + "execution_count": 6 }, { "cell_type": "code", - "execution_count": 7, "id": "a03ebde91b87fa3b", "metadata": { "ExecuteTime": { - "end_time": "2023-11-07T23:05:35.216384Z", - "start_time": "2023-11-07T23:05:35.206794Z" + "end_time": "2024-07-02T22:37:52.039978Z", + "start_time": "2024-07-02T22:37:52.032015Z" } }, + "source": [ + "display(TotalList)" + ], "outputs": [ { "data": { + "text/plain": [ + " name gps list\n", + "0 521 Commercial Street #525 [42.3688272, -71.0553792] A\n", + "1 Acorn St [42.3576234, -71.0688746] A\n", + "2 Arlington's Great Meadows [42.4299758, -71.2038948] A\n", + "3 Arthur Fiedler Statue [42.3565057, -71.0754527] A\n", + "4 BU Beach [42.3511927, -71.1060828] A\n", + ".. ... ... ...\n", + "31 Union Square [42.37736, -71.09476] B\n", + "32 University Park Commons [42.3614115, -71.1014951] B\n", + "33 Veggie Crust - Somerville [42.3822934, -71.1024769] B\n", + "34 Veggie Galaxy [42.3636597, -71.1011111] B\n", + "35 Warren Tavern [42.3741694, -71.0631664] B\n", + "\n", + "[98 rows x 3 columns]" + ], "text/html": [ "
\n", "