Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "cells": [
- {
- "cell_type": "code",
- "execution_count": 4,
- "metadata": {},
- "outputs": [
- {
- "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>Postcode</th>\n",
- " <th>Borough</th>\n",
- " <th>Neighbourhood</th>\n",
- " </tr>\n",
- " </thead>\n",
- " <tbody>\n",
- " <tr>\n",
- " <th>0</th>\n",
- " <td>M1B</td>\n",
- " <td>Scarborough</td>\n",
- " <td>Rouge,Malvern</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>1</th>\n",
- " <td>M1C</td>\n",
- " <td>Scarborough</td>\n",
- " <td>Highland Creek,Rouge Hill,Port Union</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>2</th>\n",
- " <td>M1E</td>\n",
- " <td>Scarborough</td>\n",
- " <td>Guildwood,Morningside,West Hill</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>3</th>\n",
- " <td>M1G</td>\n",
- " <td>Scarborough</td>\n",
- " <td>Woburn</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>4</th>\n",
- " <td>M1H</td>\n",
- " <td>Scarborough</td>\n",
- " <td>Cedarbrae</td>\n",
- " </tr>\n",
- " </tbody>\n",
- "</table>\n",
- "</div>"
- ],
- "text/plain": [
- " Postcode Borough Neighbourhood\n",
- "0 M1B Scarborough Rouge,Malvern\n",
- "1 M1C Scarborough Highland Creek,Rouge Hill,Port Union\n",
- "2 M1E Scarborough Guildwood,Morningside,West Hill\n",
- "3 M1G Scarborough Woburn\n",
- "4 M1H Scarborough Cedarbrae"
- ]
- },
- "execution_count": 4,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "import pandas as pd\n",
- "df = pd.read_csv('task1.csv')\n",
- "df.head()"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 11,
- "metadata": {},
- "outputs": [
- {
- "name": "stdout",
- "output_type": "stream",
- "text": [
- "Collecting package metadata: done\n",
- "Solving environment: / \n",
- "The environment is inconsistent, please check the package plan carefully\n",
- "The following packages are causing the inconsistency:\n",
- "\n",
- " - anaconda/linux-64::conda-build==3.17.8=py36_0\n",
- " - anaconda/linux-64::grpcio==1.16.1=py36hf8bcb03_1\n",
- " - anaconda/linux-64::keras==2.1.5=py36_0\n",
- " - anaconda/linux-64::libarchive==3.3.3=h5d8350f_5\n",
- " - anaconda/linux-64::python-libarchive-c==2.8=py36_6\n",
- " - anaconda/linux-64::tensorboard==1.8.0=py36hf484d3e_0\n",
- " - anaconda/linux-64::tensorflow==1.8.0=h57681fa_0\n",
- " - anaconda/linux-64::tensorflow-base==1.8.0=py36h5f64886_0\n",
- " - defaults/linux-64::anaconda==5.3.1=py37_0\n",
- " - defaults/linux-64::astropy==3.0.4=py37h14c3975_0\n",
- " - defaults/linux-64::bkcharts==0.2=py37_0\n",
- " - defaults/linux-64::blaze==0.11.3=py37_0\n",
- " - defaults/linux-64::bokeh==0.13.0=py37_0\n",
- " - defaults/linux-64::bottleneck==1.2.1=py37h035aef0_1\n",
- " - defaults/linux-64::dask==0.19.1=py37_0\n",
- " - defaults/linux-64::datashape==0.5.4=py37_1\n",
- " - defaults/linux-64::mkl-service==1.1.2=py37h90e4bf4_5\n",
- " - defaults/linux-64::numba==0.39.0=py37h04863e7_0\n",
- " - defaults/linux-64::numexpr==2.6.8=py37hd89afb7_0\n",
- " - defaults/linux-64::odo==0.5.1=py37_0\n",
- " - defaults/linux-64::pytables==3.4.4=py37ha205bf6_0\n",
- " - defaults/linux-64::pytest-arraydiff==0.2=py37h39e3cac_0\n",
- " - defaults/linux-64::pytest-astropy==0.4.0=py37_0\n",
- " - defaults/linux-64::pytest-doctestplus==0.1.3=py37_0\n",
- " - defaults/linux-64::pywavelets==1.0.0=py37hdd07704_0\n",
- " - defaults/linux-64::scikit-image==0.14.0=py37hf484d3e_1\n",
- "done\n",
- "\n",
- "## Package Plan ##\n",
- "\n",
- " environment location: /home/jupyterlab/conda\n",
- "\n",
- " added / updated specs:\n",
- " - geocoder\n",
- "\n",
- "\n",
- "The following packages will be downloaded:\n",
- "\n",
- " package | build\n",
- " ---------------------------|-----------------\n",
- " conda-4.7.5 | py36_0 3.0 MB conda-forge\n",
- " conda-package-handling-1.3.10| py36_0 257 KB conda-forge\n",
- " future-0.17.1 | py36_1000 701 KB conda-forge\n",
- " geocoder-1.38.1 | py_1 53 KB conda-forge\n",
- " libarchive-3.3.3 | hb44662c_1005 1.4 MB conda-forge\n",
- " libiconv-1.15 | h516909a_1005 2.0 MB conda-forge\n",
- " libxml2-2.9.9 | h13577e0_1 1.3 MB conda-forge\n",
- " python-libarchive-c-2.8 | py36_1004 21 KB conda-forge\n",
- " ratelim-0.1.6 | py_2 6 KB conda-forge\n",
- " ------------------------------------------------------------\n",
- " Total: 8.8 MB\n",
- "\n",
- "The following NEW packages will be INSTALLED:\n",
- "\n",
- " conda-package-han~ conda-forge/linux-64::conda-package-handling-1.3.10-py36_0\n",
- " future conda-forge/linux-64::future-0.17.1-py36_1000\n",
- " geocoder conda-forge/noarch::geocoder-1.38.1-py_1\n",
- " libiconv conda-forge/linux-64::libiconv-1.15-h516909a_1005\n",
- " ratelim conda-forge/noarch::ratelim-0.1.6-py_2\n",
- "\n",
- "The following packages will be UPDATED:\n",
- "\n",
- " conda anaconda::conda-4.6.14-py36_0 --> conda-forge::conda-4.7.5-py36_0\n",
- " libarchive anaconda::libarchive-3.3.3-h5d8350f_5 --> conda-forge::libarchive-3.3.3-hb44662c_1005\n",
- " libxml2 pkgs/main::libxml2-2.9.8-h26e45fe_1 --> conda-forge::libxml2-2.9.9-h13577e0_1\n",
- " python-libarchive~ anaconda::python-libarchive-c-2.8-py3~ --> conda-forge::python-libarchive-c-2.8-py36_1004\n",
- "\n",
- "\n",
- "\n",
- "Downloading and Extracting Packages\n",
- "conda-package-handli | 257 KB | ##################################### | 100% \n",
- "conda-4.7.5 | 3.0 MB | ##################################### | 100% \n",
- "future-0.17.1 | 701 KB | ##################################### | 100% \n",
- "python-libarchive-c- | 21 KB | ##################################### | 100% \n",
- "libiconv-1.15 | 2.0 MB | ##################################### | 100% \n",
- "ratelim-0.1.6 | 6 KB | ##################################### | 100% \n",
- "libxml2-2.9.9 | 1.3 MB | ##################################### | 100% \n",
- "geocoder-1.38.1 | 53 KB | ##################################### | 100% \n",
- "libarchive-3.3.3 | 1.4 MB | ##################################### | 100% \n",
- "Preparing transaction: done\n",
- "Verifying transaction: done\n",
- "Executing transaction: done\n",
- "\n",
- "Note: you may need to restart the kernel to use updated packages.\n"
- ]
- }
- ],
- "source": [
- "conda install -c conda-forge geocoder"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 12,
- "metadata": {},
- "outputs": [],
- "source": [
- "import geocoder"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 13,
- "metadata": {},
- "outputs": [
- {
- "data": {
- "text/plain": [
- "[43.70976500000006, -79.36390090899994]"
- ]
- },
- "execution_count": 13,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "\n",
- "def get_latlng(postal_code):\n",
- " # initialize your variable to None\n",
- " lat_lng_coords = None\n",
- " # loop until you get the coordinates\n",
- " while(lat_lng_coords is None):\n",
- " g = geocoder.arcgis('{}, Toronto, Ontario'.format(postal_code))\n",
- " lat_lng_coords = g.latlng\n",
- " return lat_lng_coords\n",
- " \n",
- "get_latlng('M4G')"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 16,
- "metadata": {},
- "outputs": [],
- "source": [
- "postal_codes = df['Postcode'] \n",
- "coords = [ get_latlng(postal_code) for postal_code in postal_codes.tolist() ]"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 17,
- "metadata": {},
- "outputs": [
- {
- "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>Postcode</th>\n",
- " <th>Borough</th>\n",
- " <th>Neighbourhood</th>\n",
- " <th>Latitude</th>\n",
- " <th>Longitude</th>\n",
- " </tr>\n",
- " </thead>\n",
- " <tbody>\n",
- " <tr>\n",
- " <th>0</th>\n",
- " <td>M1B</td>\n",
- " <td>Scarborough</td>\n",
- " <td>Rouge,Malvern</td>\n",
- " <td>43.811525</td>\n",
- " <td>-79.195517</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>1</th>\n",
- " <td>M1C</td>\n",
- " <td>Scarborough</td>\n",
- " <td>Highland Creek,Rouge Hill,Port Union</td>\n",
- " <td>43.785730</td>\n",
- " <td>-79.158750</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>2</th>\n",
- " <td>M1E</td>\n",
- " <td>Scarborough</td>\n",
- " <td>Guildwood,Morningside,West Hill</td>\n",
- " <td>43.765690</td>\n",
- " <td>-79.175256</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>3</th>\n",
- " <td>M1G</td>\n",
- " <td>Scarborough</td>\n",
- " <td>Woburn</td>\n",
- " <td>43.768359</td>\n",
- " <td>-79.217590</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>4</th>\n",
- " <td>M1H</td>\n",
- " <td>Scarborough</td>\n",
- " <td>Cedarbrae</td>\n",
- " <td>43.769688</td>\n",
- " <td>-79.239440</td>\n",
- " </tr>\n",
- " </tbody>\n",
- "</table>\n",
- "</div>"
- ],
- "text/plain": [
- " Postcode Borough Neighbourhood Latitude \\\n",
- "0 M1B Scarborough Rouge,Malvern 43.811525 \n",
- "1 M1C Scarborough Highland Creek,Rouge Hill,Port Union 43.785730 \n",
- "2 M1E Scarborough Guildwood,Morningside,West Hill 43.765690 \n",
- "3 M1G Scarborough Woburn 43.768359 \n",
- "4 M1H Scarborough Cedarbrae 43.769688 \n",
- "\n",
- " Longitude \n",
- "0 -79.195517 \n",
- "1 -79.158750 \n",
- "2 -79.175256 \n",
- "3 -79.217590 \n",
- "4 -79.239440 "
- ]
- },
- "execution_count": 17,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "df_coords = pd.DataFrame(coords, columns=['Latitude', 'Longitude'])\n",
- "df['Latitude'] = df_coords['Latitude']\n",
- "df['Longitude'] = df_coords['Longitude']\n",
- "df.head()"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 20,
- "metadata": {},
- "outputs": [
- {
- "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>Postcode</th>\n",
- " <th>Borough</th>\n",
- " <th>Neighbourhood</th>\n",
- " <th>Latitude</th>\n",
- " <th>Longitude</th>\n",
- " </tr>\n",
- " </thead>\n",
- " <tbody>\n",
- " <tr>\n",
- " <th>57</th>\n",
- " <td>M5G</td>\n",
- " <td>Downtown Toronto</td>\n",
- " <td>Central Bay Street</td>\n",
- " <td>43.656091</td>\n",
- " <td>-79.38493</td>\n",
- " </tr>\n",
- " </tbody>\n",
- "</table>\n",
- "</div>"
- ],
- "text/plain": [
- " Postcode Borough Neighbourhood Latitude Longitude\n",
- "57 M5G Downtown Toronto Central Bay Street 43.656091 -79.38493"
- ]
- },
- "execution_count": 20,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "df[df.Postcode == 'M5G']"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 21,
- "metadata": {},
- "outputs": [],
- "source": [
- "df.to_csv('task2.csv', index=False)"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": 22,
- "metadata": {},
- "outputs": [
- {
- "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>Postcode</th>\n",
- " <th>Borough</th>\n",
- " <th>Neighbourhood</th>\n",
- " <th>Latitude</th>\n",
- " <th>Longitude</th>\n",
- " </tr>\n",
- " </thead>\n",
- " <tbody>\n",
- " <tr>\n",
- " <th>0</th>\n",
- " <td>M1B</td>\n",
- " <td>Scarborough</td>\n",
- " <td>Rouge,Malvern</td>\n",
- " <td>43.811525</td>\n",
- " <td>-79.195517</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>1</th>\n",
- " <td>M1C</td>\n",
- " <td>Scarborough</td>\n",
- " <td>Highland Creek,Rouge Hill,Port Union</td>\n",
- " <td>43.785730</td>\n",
- " <td>-79.158750</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>2</th>\n",
- " <td>M1E</td>\n",
- " <td>Scarborough</td>\n",
- " <td>Guildwood,Morningside,West Hill</td>\n",
- " <td>43.765690</td>\n",
- " <td>-79.175256</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>3</th>\n",
- " <td>M1G</td>\n",
- " <td>Scarborough</td>\n",
- " <td>Woburn</td>\n",
- " <td>43.768359</td>\n",
- " <td>-79.217590</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>4</th>\n",
- " <td>M1H</td>\n",
- " <td>Scarborough</td>\n",
- " <td>Cedarbrae</td>\n",
- " <td>43.769688</td>\n",
- " <td>-79.239440</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>5</th>\n",
- " <td>M1J</td>\n",
- " <td>Scarborough</td>\n",
- " <td>Scarborough Village</td>\n",
- " <td>43.743125</td>\n",
- " <td>-79.231750</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>6</th>\n",
- " <td>M1K</td>\n",
- " <td>Scarborough</td>\n",
- " <td>East Birchmount Park,Ionview,Kennedy Park</td>\n",
- " <td>43.726245</td>\n",
- " <td>-79.263670</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>7</th>\n",
- " <td>M1L</td>\n",
- " <td>Scarborough</td>\n",
- " <td>Clairlea,Golden Mile,Oakridge</td>\n",
- " <td>43.713133</td>\n",
- " <td>-79.285055</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>8</th>\n",
- " <td>M1M</td>\n",
- " <td>Scarborough</td>\n",
- " <td>Cliffcrest,Cliffside,Scarborough Village West</td>\n",
- " <td>43.723575</td>\n",
- " <td>-79.234976</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>9</th>\n",
- " <td>M1N</td>\n",
- " <td>Scarborough</td>\n",
- " <td>Birch Cliff,Cliffside West</td>\n",
- " <td>43.696665</td>\n",
- " <td>-79.260163</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>10</th>\n",
- " <td>M1P</td>\n",
- " <td>Scarborough</td>\n",
- " <td>Dorset Park,Scarborough Town Centre,Wexford He...</td>\n",
- " <td>43.759975</td>\n",
- " <td>-79.268974</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>11</th>\n",
- " <td>M1R</td>\n",
- " <td>Scarborough</td>\n",
- " <td>Maryvale,Wexford</td>\n",
- " <td>43.750710</td>\n",
- " <td>-79.300560</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>12</th>\n",
- " <td>M1S</td>\n",
- " <td>Scarborough</td>\n",
- " <td>Agincourt</td>\n",
- " <td>43.793940</td>\n",
- " <td>-79.267983</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>13</th>\n",
- " <td>M1T</td>\n",
- " <td>Scarborough</td>\n",
- " <td>Clarks Corners,Sullivan,Tam O'Shanter</td>\n",
- " <td>43.784725</td>\n",
- " <td>-79.299047</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>14</th>\n",
- " <td>M1V</td>\n",
- " <td>Scarborough</td>\n",
- " <td>Agincourt North,L'Amoreaux East,Milliken,Steel...</td>\n",
- " <td>43.817810</td>\n",
- " <td>-79.280244</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>15</th>\n",
- " <td>M1W</td>\n",
- " <td>Scarborough</td>\n",
- " <td>L'Amoreaux West</td>\n",
- " <td>43.800881</td>\n",
- " <td>-79.320740</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>16</th>\n",
- " <td>M1X</td>\n",
- " <td>Scarborough</td>\n",
- " <td>Upper Rouge</td>\n",
- " <td>43.834215</td>\n",
- " <td>-79.216701</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>17</th>\n",
- " <td>M2H</td>\n",
- " <td>North York</td>\n",
- " <td>Hillcrest Village</td>\n",
- " <td>43.802845</td>\n",
- " <td>-79.356236</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>18</th>\n",
- " <td>M2J</td>\n",
- " <td>North York</td>\n",
- " <td>Fairview,Henry Farm,Oriole</td>\n",
- " <td>43.780880</td>\n",
- " <td>-79.347796</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>19</th>\n",
- " <td>M2K</td>\n",
- " <td>North York</td>\n",
- " <td>Bayview Village</td>\n",
- " <td>43.781015</td>\n",
- " <td>-79.380542</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>20</th>\n",
- " <td>M2L</td>\n",
- " <td>North York</td>\n",
- " <td>Silver Hills,York Mills</td>\n",
- " <td>43.757192</td>\n",
- " <td>-79.379865</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>21</th>\n",
- " <td>M2M</td>\n",
- " <td>North York</td>\n",
- " <td>Newtonbrook,Willowdale</td>\n",
- " <td>43.791475</td>\n",
- " <td>-79.413605</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>22</th>\n",
- " <td>M2N</td>\n",
- " <td>North York</td>\n",
- " <td>Willowdale South</td>\n",
- " <td>43.768165</td>\n",
- " <td>-79.407420</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>23</th>\n",
- " <td>M2P</td>\n",
- " <td>North York</td>\n",
- " <td>York Mills West</td>\n",
- " <td>43.747855</td>\n",
- " <td>-79.400062</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>24</th>\n",
- " <td>M2R</td>\n",
- " <td>North York</td>\n",
- " <td>Willowdale West</td>\n",
- " <td>43.777695</td>\n",
- " <td>-79.445797</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>25</th>\n",
- " <td>M3A</td>\n",
- " <td>North York</td>\n",
- " <td>Parkwoods</td>\n",
- " <td>43.752440</td>\n",
- " <td>-79.329271</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>26</th>\n",
- " <td>M3B</td>\n",
- " <td>North York</td>\n",
- " <td>Don Mills North</td>\n",
- " <td>43.749195</td>\n",
- " <td>-79.361905</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>27</th>\n",
- " <td>M3C</td>\n",
- " <td>North York</td>\n",
- " <td>Flemingdon Park,Don Mills South</td>\n",
- " <td>43.721425</td>\n",
- " <td>-79.343453</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>28</th>\n",
- " <td>M3H</td>\n",
- " <td>North York</td>\n",
- " <td>Bathurst Manor,Downsview North,Wilson Heights</td>\n",
- " <td>43.757565</td>\n",
- " <td>-79.448191</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>29</th>\n",
- " <td>M3J</td>\n",
- " <td>North York</td>\n",
- " <td>Northwood Park,York University</td>\n",
- " <td>43.764665</td>\n",
- " <td>-79.487183</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>...</th>\n",
- " <td>...</td>\n",
- " <td>...</td>\n",
- " <td>...</td>\n",
- " <td>...</td>\n",
- " <td>...</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>73</th>\n",
- " <td>M6C</td>\n",
- " <td>York</td>\n",
- " <td>Humewood-Cedarvale</td>\n",
- " <td>43.692105</td>\n",
- " <td>-79.430355</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>74</th>\n",
- " <td>M6E</td>\n",
- " <td>York</td>\n",
- " <td>Caledonia-Fairbanks</td>\n",
- " <td>43.688640</td>\n",
- " <td>-79.451015</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>75</th>\n",
- " <td>M6G</td>\n",
- " <td>Downtown Toronto</td>\n",
- " <td>Christie</td>\n",
- " <td>43.668781</td>\n",
- " <td>-79.420710</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>76</th>\n",
- " <td>M6H</td>\n",
- " <td>West Toronto</td>\n",
- " <td>Dovercourt Village,Dufferin</td>\n",
- " <td>43.665087</td>\n",
- " <td>-79.438705</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>77</th>\n",
- " <td>M6J</td>\n",
- " <td>West Toronto</td>\n",
- " <td>Little Portugal,Trinity</td>\n",
- " <td>43.648485</td>\n",
- " <td>-79.417742</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>78</th>\n",
- " <td>M6K</td>\n",
- " <td>West Toronto</td>\n",
- " <td>Brockton,Exhibition Place,Parkdale Village</td>\n",
- " <td>43.639410</td>\n",
- " <td>-79.424362</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>79</th>\n",
- " <td>M6L</td>\n",
- " <td>North York</td>\n",
- " <td>Downsview,North Park,Upwood Park</td>\n",
- " <td>43.713810</td>\n",
- " <td>-79.488305</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>80</th>\n",
- " <td>M6M</td>\n",
- " <td>York</td>\n",
- " <td>Del Ray,Keelesdale,Mount Dennis,Silverthorn</td>\n",
- " <td>43.694545</td>\n",
- " <td>-79.484643</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>81</th>\n",
- " <td>M6N</td>\n",
- " <td>York</td>\n",
- " <td>The Junction North,Runnymede</td>\n",
- " <td>43.675825</td>\n",
- " <td>-79.482052</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>82</th>\n",
- " <td>M6P</td>\n",
- " <td>West Toronto</td>\n",
- " <td>High Park,The Junction South</td>\n",
- " <td>43.659975</td>\n",
- " <td>-79.462874</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>83</th>\n",
- " <td>M6R</td>\n",
- " <td>West Toronto</td>\n",
- " <td>Parkdale,Roncesvalles</td>\n",
- " <td>43.647870</td>\n",
- " <td>-79.449762</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>84</th>\n",
- " <td>M6S</td>\n",
- " <td>West Toronto</td>\n",
- " <td>Runnymede,Swansea</td>\n",
- " <td>43.649885</td>\n",
- " <td>-79.474929</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>85</th>\n",
- " <td>M7A</td>\n",
- " <td>Queen's Park</td>\n",
- " <td>Not assigned</td>\n",
- " <td>43.661102</td>\n",
- " <td>-79.391035</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>86</th>\n",
- " <td>M7R</td>\n",
- " <td>Mississauga</td>\n",
- " <td>Canada Post Gateway Processing Centre</td>\n",
- " <td>43.648690</td>\n",
- " <td>-79.385440</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>87</th>\n",
- " <td>M7Y</td>\n",
- " <td>East Toronto</td>\n",
- " <td>Business Reply Mail Processing Centre 969 Eastern</td>\n",
- " <td>43.648690</td>\n",
- " <td>-79.385440</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>88</th>\n",
- " <td>M8V</td>\n",
- " <td>Etobicoke</td>\n",
- " <td>Humber Bay Shores,Mimico South,New Toronto</td>\n",
- " <td>43.609870</td>\n",
- " <td>-79.498178</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>89</th>\n",
- " <td>M8W</td>\n",
- " <td>Etobicoke</td>\n",
- " <td>Alderwood,Long Branch</td>\n",
- " <td>43.601131</td>\n",
- " <td>-79.538785</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>90</th>\n",
- " <td>M8X</td>\n",
- " <td>Etobicoke</td>\n",
- " <td>The Kingsway,Montgomery Road,Old Mill North</td>\n",
- " <td>43.653690</td>\n",
- " <td>-79.511117</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>91</th>\n",
- " <td>M8Y</td>\n",
- " <td>Etobicoke</td>\n",
- " <td>Humber Bay,King's Mill Park,Kingsway Park Sout...</td>\n",
- " <td>43.632765</td>\n",
- " <td>-79.489601</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>92</th>\n",
- " <td>M8Z</td>\n",
- " <td>Etobicoke</td>\n",
- " <td>Kingsway Park South West,Mimico NW,The Queensw...</td>\n",
- " <td>43.624630</td>\n",
- " <td>-79.526950</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>93</th>\n",
- " <td>M9A</td>\n",
- " <td>Etobicoke</td>\n",
- " <td>Islington Avenue</td>\n",
- " <td>43.662242</td>\n",
- " <td>-79.528379</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>94</th>\n",
- " <td>M9B</td>\n",
- " <td>Etobicoke</td>\n",
- " <td>Cloverdale,Islington,Martin Grove,Princess Gar...</td>\n",
- " <td>43.649692</td>\n",
- " <td>-79.553945</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>95</th>\n",
- " <td>M9C</td>\n",
- " <td>Etobicoke</td>\n",
- " <td>Bloordale Gardens,Eringate,Markland Wood,Old B...</td>\n",
- " <td>43.648573</td>\n",
- " <td>-79.578250</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>96</th>\n",
- " <td>M9L</td>\n",
- " <td>North York</td>\n",
- " <td>Humber Summit</td>\n",
- " <td>43.759500</td>\n",
- " <td>-79.556852</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>97</th>\n",
- " <td>M9M</td>\n",
- " <td>North York</td>\n",
- " <td>Emery,Humberlea</td>\n",
- " <td>43.733760</td>\n",
- " <td>-79.537522</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>98</th>\n",
- " <td>M9N</td>\n",
- " <td>York</td>\n",
- " <td>Weston</td>\n",
- " <td>43.704855</td>\n",
- " <td>-79.517552</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>99</th>\n",
- " <td>M9P</td>\n",
- " <td>Etobicoke</td>\n",
- " <td>Westmount</td>\n",
- " <td>43.696300</td>\n",
- " <td>-79.530399</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>100</th>\n",
- " <td>M9R</td>\n",
- " <td>Etobicoke</td>\n",
- " <td>Kingsview Village,Martin Grove Gardens,Richvie...</td>\n",
- " <td>43.686915</td>\n",
- " <td>-79.557276</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>101</th>\n",
- " <td>M9V</td>\n",
- " <td>Etobicoke</td>\n",
- " <td>Albion Gardens,Beaumond Heights,Humbergate,Jam...</td>\n",
- " <td>43.743205</td>\n",
- " <td>-79.584701</td>\n",
- " </tr>\n",
- " <tr>\n",
- " <th>102</th>\n",
- " <td>M9W</td>\n",
- " <td>Etobicoke</td>\n",
- " <td>Northwest</td>\n",
- " <td>43.711740</td>\n",
- " <td>-79.579181</td>\n",
- " </tr>\n",
- " </tbody>\n",
- "</table>\n",
- "<p>103 rows × 5 columns</p>\n",
- "</div>"
- ],
- "text/plain": [
- " Postcode Borough \\\n",
- "0 M1B Scarborough \n",
- "1 M1C Scarborough \n",
- "2 M1E Scarborough \n",
- "3 M1G Scarborough \n",
- "4 M1H Scarborough \n",
- "5 M1J Scarborough \n",
- "6 M1K Scarborough \n",
- "7 M1L Scarborough \n",
- "8 M1M Scarborough \n",
- "9 M1N Scarborough \n",
- "10 M1P Scarborough \n",
- "11 M1R Scarborough \n",
- "12 M1S Scarborough \n",
- "13 M1T Scarborough \n",
- "14 M1V Scarborough \n",
- "15 M1W Scarborough \n",
- "16 M1X Scarborough \n",
- "17 M2H North York \n",
- "18 M2J North York \n",
- "19 M2K North York \n",
- "20 M2L North York \n",
- "21 M2M North York \n",
- "22 M2N North York \n",
- "23 M2P North York \n",
- "24 M2R North York \n",
- "25 M3A North York \n",
- "26 M3B North York \n",
- "27 M3C North York \n",
- "28 M3H North York \n",
- "29 M3J North York \n",
- ".. ... ... \n",
- "73 M6C York \n",
- "74 M6E York \n",
- "75 M6G Downtown Toronto \n",
- "76 M6H West Toronto \n",
- "77 M6J West Toronto \n",
- "78 M6K West Toronto \n",
- "79 M6L North York \n",
- "80 M6M York \n",
- "81 M6N York \n",
- "82 M6P West Toronto \n",
- "83 M6R West Toronto \n",
- "84 M6S West Toronto \n",
- "85 M7A Queen's Park \n",
- "86 M7R Mississauga \n",
- "87 M7Y East Toronto \n",
- "88 M8V Etobicoke \n",
- "89 M8W Etobicoke \n",
- "90 M8X Etobicoke \n",
- "91 M8Y Etobicoke \n",
- "92 M8Z Etobicoke \n",
- "93 M9A Etobicoke \n",
- "94 M9B Etobicoke \n",
- "95 M9C Etobicoke \n",
- "96 M9L North York \n",
- "97 M9M North York \n",
- "98 M9N York \n",
- "99 M9P Etobicoke \n",
- "100 M9R Etobicoke \n",
- "101 M9V Etobicoke \n",
- "102 M9W Etobicoke \n",
- "\n",
- " Neighbourhood Latitude Longitude \n",
- "0 Rouge,Malvern 43.811525 -79.195517 \n",
- "1 Highland Creek,Rouge Hill,Port Union 43.785730 -79.158750 \n",
- "2 Guildwood,Morningside,West Hill 43.765690 -79.175256 \n",
- "3 Woburn 43.768359 -79.217590 \n",
- "4 Cedarbrae 43.769688 -79.239440 \n",
- "5 Scarborough Village 43.743125 -79.231750 \n",
- "6 East Birchmount Park,Ionview,Kennedy Park 43.726245 -79.263670 \n",
- "7 Clairlea,Golden Mile,Oakridge 43.713133 -79.285055 \n",
- "8 Cliffcrest,Cliffside,Scarborough Village West 43.723575 -79.234976 \n",
- "9 Birch Cliff,Cliffside West 43.696665 -79.260163 \n",
- "10 Dorset Park,Scarborough Town Centre,Wexford He... 43.759975 -79.268974 \n",
- "11 Maryvale,Wexford 43.750710 -79.300560 \n",
- "12 Agincourt 43.793940 -79.267983 \n",
- "13 Clarks Corners,Sullivan,Tam O'Shanter 43.784725 -79.299047 \n",
- "14 Agincourt North,L'Amoreaux East,Milliken,Steel... 43.817810 -79.280244 \n",
- "15 L'Amoreaux West 43.800881 -79.320740 \n",
- "16 Upper Rouge 43.834215 -79.216701 \n",
- "17 Hillcrest Village 43.802845 -79.356236 \n",
- "18 Fairview,Henry Farm,Oriole 43.780880 -79.347796 \n",
- "19 Bayview Village 43.781015 -79.380542 \n",
- "20 Silver Hills,York Mills 43.757192 -79.379865 \n",
- "21 Newtonbrook,Willowdale 43.791475 -79.413605 \n",
- "22 Willowdale South 43.768165 -79.407420 \n",
- "23 York Mills West 43.747855 -79.400062 \n",
- "24 Willowdale West 43.777695 -79.445797 \n",
- "25 Parkwoods 43.752440 -79.329271 \n",
- "26 Don Mills North 43.749195 -79.361905 \n",
- "27 Flemingdon Park,Don Mills South 43.721425 -79.343453 \n",
- "28 Bathurst Manor,Downsview North,Wilson Heights 43.757565 -79.448191 \n",
- "29 Northwood Park,York University 43.764665 -79.487183 \n",
- ".. ... ... ... \n",
- "73 Humewood-Cedarvale 43.692105 -79.430355 \n",
- "74 Caledonia-Fairbanks 43.688640 -79.451015 \n",
- "75 Christie 43.668781 -79.420710 \n",
- "76 Dovercourt Village,Dufferin 43.665087 -79.438705 \n",
- "77 Little Portugal,Trinity 43.648485 -79.417742 \n",
- "78 Brockton,Exhibition Place,Parkdale Village 43.639410 -79.424362 \n",
- "79 Downsview,North Park,Upwood Park 43.713810 -79.488305 \n",
- "80 Del Ray,Keelesdale,Mount Dennis,Silverthorn 43.694545 -79.484643 \n",
- "81 The Junction North,Runnymede 43.675825 -79.482052 \n",
- "82 High Park,The Junction South 43.659975 -79.462874 \n",
- "83 Parkdale,Roncesvalles 43.647870 -79.449762 \n",
- "84 Runnymede,Swansea 43.649885 -79.474929 \n",
- "85 Not assigned 43.661102 -79.391035 \n",
- "86 Canada Post Gateway Processing Centre 43.648690 -79.385440 \n",
- "87 Business Reply Mail Processing Centre 969 Eastern 43.648690 -79.385440 \n",
- "88 Humber Bay Shores,Mimico South,New Toronto 43.609870 -79.498178 \n",
- "89 Alderwood,Long Branch 43.601131 -79.538785 \n",
- "90 The Kingsway,Montgomery Road,Old Mill North 43.653690 -79.511117 \n",
- "91 Humber Bay,King's Mill Park,Kingsway Park Sout... 43.632765 -79.489601 \n",
- "92 Kingsway Park South West,Mimico NW,The Queensw... 43.624630 -79.526950 \n",
- "93 Islington Avenue 43.662242 -79.528379 \n",
- "94 Cloverdale,Islington,Martin Grove,Princess Gar... 43.649692 -79.553945 \n",
- "95 Bloordale Gardens,Eringate,Markland Wood,Old B... 43.648573 -79.578250 \n",
- "96 Humber Summit 43.759500 -79.556852 \n",
- "97 Emery,Humberlea 43.733760 -79.537522 \n",
- "98 Weston 43.704855 -79.517552 \n",
- "99 Westmount 43.696300 -79.530399 \n",
- "100 Kingsview Village,Martin Grove Gardens,Richvie... 43.686915 -79.557276 \n",
- "101 Albion Gardens,Beaumond Heights,Humbergate,Jam... 43.743205 -79.584701 \n",
- "102 Northwest 43.711740 -79.579181 \n",
- "\n",
- "[103 rows x 5 columns]"
- ]
- },
- "execution_count": 22,
- "metadata": {},
- "output_type": "execute_result"
- }
- ],
- "source": [
- "df"
- ]
- },
- {
- "cell_type": "code",
- "execution_count": null,
- "metadata": {},
- "outputs": [],
- "source": []
- }
- ],
- "metadata": {
- "kernelspec": {
- "display_name": "Python 3",
- "language": "python",
- "name": "python3"
- },
- "language_info": {
- "codemirror_mode": {
- "name": "ipython",
- "version": 3
- },
- "file_extension": ".py",
- "mimetype": "text/x-python",
- "name": "python",
- "nbconvert_exporter": "python",
- "pygments_lexer": "ipython3",
- "version": "3.6.7"
- }
- },
- "nbformat": 4,
- "nbformat_minor": 4
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement