{ "cells": [ { "cell_type": "code", "execution_count": 1, "metadata": {}, "outputs": [], "source": [ "import os\n", "import pandas as pd\n", "import numpy as np\n", "import gmaps\n", "import gmaps.datasets" ] }, { "cell_type": "code", "execution_count": 2, "metadata": {}, "outputs": [], "source": [ "gmaps.configure(api_key=\"YOUR_KEY_HERE\")" ] }, { "cell_type": "code", "execution_count": 3, "metadata": {}, "outputs": [ { "data": { "text/html": [ "
\n", "\n", "\n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
latitudelongitude
041.815545-87.690810
141.900575-87.696901
241.830372-87.681430
341.911148-87.638639
441.790842-87.622408
541.883677-87.693992
641.764226-87.580604
741.754561-87.555020
841.832746-87.620598
941.705333-87.614970
1041.737111-87.575636
1141.791378-87.732950
1241.937368-87.695428
1341.821426-87.627510
1441.875338-87.661892
1541.805031-87.664964
1641.951915-87.716582
1741.983038-87.773208
1841.969704-87.767614
1941.941820-87.652204
2041.749949-87.684142
2141.842529-87.707440
2241.995671-87.793647
2341.749019-87.624401
2441.908607-87.687179
\n", "
" ], "text/plain": [ " latitude longitude\n", "0 41.815545 -87.690810\n", "1 41.900575 -87.696901\n", "2 41.830372 -87.681430\n", "3 41.911148 -87.638639\n", "4 41.790842 -87.622408\n", "5 41.883677 -87.693992\n", "6 41.764226 -87.580604\n", "7 41.754561 -87.555020\n", "8 41.832746 -87.620598\n", "9 41.705333 -87.614970\n", "10 41.737111 -87.575636\n", "11 41.791378 -87.732950\n", "12 41.937368 -87.695428\n", "13 41.821426 -87.627510\n", "14 41.875338 -87.661892\n", "15 41.805031 -87.664964\n", "16 41.951915 -87.716582\n", "17 41.983038 -87.773208\n", "18 41.969704 -87.767614\n", "19 41.941820 -87.652204\n", "20 41.749949 -87.684142\n", "21 41.842529 -87.707440\n", "22 41.995671 -87.793647\n", "23 41.749019 -87.624401\n", "24 41.908607 -87.687179" ] }, "execution_count": 3, "metadata": {}, "output_type": "execute_result" } ], "source": [ "CSV_PATH = os.path.join('data', 'geocodes_sample.csv')\n", "df = pd.read_csv(CSV_PATH, low_memory=False)\n", "mappable = df.drop(labels='ticket', axis=1)\n", "mappable" ] }, { "cell_type": "code", "execution_count": 8, "metadata": {}, "outputs": [ { "data": { "application/vnd.jupyter.widget-view+json": { "model_id": "84dac968d3904b0d924c7b816da025f7", "version_major": 2, "version_minor": 0 }, "text/plain": [ "Figure(layout=FigureLayout(height=u'420px'))" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "fig = gmaps.figure()\n", "fig.add_layer(gmaps.heatmap_layer(mappable))\n", "fig" ] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.13" } }, "nbformat": 4, "nbformat_minor": 2 }