Advertisement
Guest User

Untitled

a guest
Jul 21st, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 40.34 KB | None | 0 0
  1. {
  2. "cells": [
  3. {
  4. "cell_type": "code",
  5. "execution_count": 4,
  6. "metadata": {},
  7. "outputs": [
  8. {
  9. "data": {
  10. "text/html": [
  11. "<div>\n",
  12. "<style scoped>\n",
  13. " .dataframe tbody tr th:only-of-type {\n",
  14. " vertical-align: middle;\n",
  15. " }\n",
  16. "\n",
  17. " .dataframe tbody tr th {\n",
  18. " vertical-align: top;\n",
  19. " }\n",
  20. "\n",
  21. " .dataframe thead th {\n",
  22. " text-align: right;\n",
  23. " }\n",
  24. "</style>\n",
  25. "<table border=\"1\" class=\"dataframe\">\n",
  26. " <thead>\n",
  27. " <tr style=\"text-align: right;\">\n",
  28. " <th></th>\n",
  29. " <th>Postcode</th>\n",
  30. " <th>Borough</th>\n",
  31. " <th>Neighbourhood</th>\n",
  32. " </tr>\n",
  33. " </thead>\n",
  34. " <tbody>\n",
  35. " <tr>\n",
  36. " <th>0</th>\n",
  37. " <td>M1B</td>\n",
  38. " <td>Scarborough</td>\n",
  39. " <td>Rouge,Malvern</td>\n",
  40. " </tr>\n",
  41. " <tr>\n",
  42. " <th>1</th>\n",
  43. " <td>M1C</td>\n",
  44. " <td>Scarborough</td>\n",
  45. " <td>Highland Creek,Rouge Hill,Port Union</td>\n",
  46. " </tr>\n",
  47. " <tr>\n",
  48. " <th>2</th>\n",
  49. " <td>M1E</td>\n",
  50. " <td>Scarborough</td>\n",
  51. " <td>Guildwood,Morningside,West Hill</td>\n",
  52. " </tr>\n",
  53. " <tr>\n",
  54. " <th>3</th>\n",
  55. " <td>M1G</td>\n",
  56. " <td>Scarborough</td>\n",
  57. " <td>Woburn</td>\n",
  58. " </tr>\n",
  59. " <tr>\n",
  60. " <th>4</th>\n",
  61. " <td>M1H</td>\n",
  62. " <td>Scarborough</td>\n",
  63. " <td>Cedarbrae</td>\n",
  64. " </tr>\n",
  65. " </tbody>\n",
  66. "</table>\n",
  67. "</div>"
  68. ],
  69. "text/plain": [
  70. " Postcode Borough Neighbourhood\n",
  71. "0 M1B Scarborough Rouge,Malvern\n",
  72. "1 M1C Scarborough Highland Creek,Rouge Hill,Port Union\n",
  73. "2 M1E Scarborough Guildwood,Morningside,West Hill\n",
  74. "3 M1G Scarborough Woburn\n",
  75. "4 M1H Scarborough Cedarbrae"
  76. ]
  77. },
  78. "execution_count": 4,
  79. "metadata": {},
  80. "output_type": "execute_result"
  81. }
  82. ],
  83. "source": [
  84. "import pandas as pd\n",
  85. "df = pd.read_csv('task1.csv')\n",
  86. "df.head()"
  87. ]
  88. },
  89. {
  90. "cell_type": "code",
  91. "execution_count": 11,
  92. "metadata": {},
  93. "outputs": [
  94. {
  95. "name": "stdout",
  96. "output_type": "stream",
  97. "text": [
  98. "Collecting package metadata: done\n",
  99. "Solving environment: / \n",
  100. "The environment is inconsistent, please check the package plan carefully\n",
  101. "The following packages are causing the inconsistency:\n",
  102. "\n",
  103. " - anaconda/linux-64::conda-build==3.17.8=py36_0\n",
  104. " - anaconda/linux-64::grpcio==1.16.1=py36hf8bcb03_1\n",
  105. " - anaconda/linux-64::keras==2.1.5=py36_0\n",
  106. " - anaconda/linux-64::libarchive==3.3.3=h5d8350f_5\n",
  107. " - anaconda/linux-64::python-libarchive-c==2.8=py36_6\n",
  108. " - anaconda/linux-64::tensorboard==1.8.0=py36hf484d3e_0\n",
  109. " - anaconda/linux-64::tensorflow==1.8.0=h57681fa_0\n",
  110. " - anaconda/linux-64::tensorflow-base==1.8.0=py36h5f64886_0\n",
  111. " - defaults/linux-64::anaconda==5.3.1=py37_0\n",
  112. " - defaults/linux-64::astropy==3.0.4=py37h14c3975_0\n",
  113. " - defaults/linux-64::bkcharts==0.2=py37_0\n",
  114. " - defaults/linux-64::blaze==0.11.3=py37_0\n",
  115. " - defaults/linux-64::bokeh==0.13.0=py37_0\n",
  116. " - defaults/linux-64::bottleneck==1.2.1=py37h035aef0_1\n",
  117. " - defaults/linux-64::dask==0.19.1=py37_0\n",
  118. " - defaults/linux-64::datashape==0.5.4=py37_1\n",
  119. " - defaults/linux-64::mkl-service==1.1.2=py37h90e4bf4_5\n",
  120. " - defaults/linux-64::numba==0.39.0=py37h04863e7_0\n",
  121. " - defaults/linux-64::numexpr==2.6.8=py37hd89afb7_0\n",
  122. " - defaults/linux-64::odo==0.5.1=py37_0\n",
  123. " - defaults/linux-64::pytables==3.4.4=py37ha205bf6_0\n",
  124. " - defaults/linux-64::pytest-arraydiff==0.2=py37h39e3cac_0\n",
  125. " - defaults/linux-64::pytest-astropy==0.4.0=py37_0\n",
  126. " - defaults/linux-64::pytest-doctestplus==0.1.3=py37_0\n",
  127. " - defaults/linux-64::pywavelets==1.0.0=py37hdd07704_0\n",
  128. " - defaults/linux-64::scikit-image==0.14.0=py37hf484d3e_1\n",
  129. "done\n",
  130. "\n",
  131. "## Package Plan ##\n",
  132. "\n",
  133. " environment location: /home/jupyterlab/conda\n",
  134. "\n",
  135. " added / updated specs:\n",
  136. " - geocoder\n",
  137. "\n",
  138. "\n",
  139. "The following packages will be downloaded:\n",
  140. "\n",
  141. " package | build\n",
  142. " ---------------------------|-----------------\n",
  143. " conda-4.7.5 | py36_0 3.0 MB conda-forge\n",
  144. " conda-package-handling-1.3.10| py36_0 257 KB conda-forge\n",
  145. " future-0.17.1 | py36_1000 701 KB conda-forge\n",
  146. " geocoder-1.38.1 | py_1 53 KB conda-forge\n",
  147. " libarchive-3.3.3 | hb44662c_1005 1.4 MB conda-forge\n",
  148. " libiconv-1.15 | h516909a_1005 2.0 MB conda-forge\n",
  149. " libxml2-2.9.9 | h13577e0_1 1.3 MB conda-forge\n",
  150. " python-libarchive-c-2.8 | py36_1004 21 KB conda-forge\n",
  151. " ratelim-0.1.6 | py_2 6 KB conda-forge\n",
  152. " ------------------------------------------------------------\n",
  153. " Total: 8.8 MB\n",
  154. "\n",
  155. "The following NEW packages will be INSTALLED:\n",
  156. "\n",
  157. " conda-package-han~ conda-forge/linux-64::conda-package-handling-1.3.10-py36_0\n",
  158. " future conda-forge/linux-64::future-0.17.1-py36_1000\n",
  159. " geocoder conda-forge/noarch::geocoder-1.38.1-py_1\n",
  160. " libiconv conda-forge/linux-64::libiconv-1.15-h516909a_1005\n",
  161. " ratelim conda-forge/noarch::ratelim-0.1.6-py_2\n",
  162. "\n",
  163. "The following packages will be UPDATED:\n",
  164. "\n",
  165. " conda anaconda::conda-4.6.14-py36_0 --> conda-forge::conda-4.7.5-py36_0\n",
  166. " libarchive anaconda::libarchive-3.3.3-h5d8350f_5 --> conda-forge::libarchive-3.3.3-hb44662c_1005\n",
  167. " libxml2 pkgs/main::libxml2-2.9.8-h26e45fe_1 --> conda-forge::libxml2-2.9.9-h13577e0_1\n",
  168. " python-libarchive~ anaconda::python-libarchive-c-2.8-py3~ --> conda-forge::python-libarchive-c-2.8-py36_1004\n",
  169. "\n",
  170. "\n",
  171. "\n",
  172. "Downloading and Extracting Packages\n",
  173. "conda-package-handli | 257 KB | ##################################### | 100% \n",
  174. "conda-4.7.5 | 3.0 MB | ##################################### | 100% \n",
  175. "future-0.17.1 | 701 KB | ##################################### | 100% \n",
  176. "python-libarchive-c- | 21 KB | ##################################### | 100% \n",
  177. "libiconv-1.15 | 2.0 MB | ##################################### | 100% \n",
  178. "ratelim-0.1.6 | 6 KB | ##################################### | 100% \n",
  179. "libxml2-2.9.9 | 1.3 MB | ##################################### | 100% \n",
  180. "geocoder-1.38.1 | 53 KB | ##################################### | 100% \n",
  181. "libarchive-3.3.3 | 1.4 MB | ##################################### | 100% \n",
  182. "Preparing transaction: done\n",
  183. "Verifying transaction: done\n",
  184. "Executing transaction: done\n",
  185. "\n",
  186. "Note: you may need to restart the kernel to use updated packages.\n"
  187. ]
  188. }
  189. ],
  190. "source": [
  191. "conda install -c conda-forge geocoder"
  192. ]
  193. },
  194. {
  195. "cell_type": "code",
  196. "execution_count": 12,
  197. "metadata": {},
  198. "outputs": [],
  199. "source": [
  200. "import geocoder"
  201. ]
  202. },
  203. {
  204. "cell_type": "code",
  205. "execution_count": 13,
  206. "metadata": {},
  207. "outputs": [
  208. {
  209. "data": {
  210. "text/plain": [
  211. "[43.70976500000006, -79.36390090899994]"
  212. ]
  213. },
  214. "execution_count": 13,
  215. "metadata": {},
  216. "output_type": "execute_result"
  217. }
  218. ],
  219. "source": [
  220. "\n",
  221. "def get_latlng(postal_code):\n",
  222. " # initialize your variable to None\n",
  223. " lat_lng_coords = None\n",
  224. " # loop until you get the coordinates\n",
  225. " while(lat_lng_coords is None):\n",
  226. " g = geocoder.arcgis('{}, Toronto, Ontario'.format(postal_code))\n",
  227. " lat_lng_coords = g.latlng\n",
  228. " return lat_lng_coords\n",
  229. " \n",
  230. "get_latlng('M4G')"
  231. ]
  232. },
  233. {
  234. "cell_type": "code",
  235. "execution_count": 16,
  236. "metadata": {},
  237. "outputs": [],
  238. "source": [
  239. "postal_codes = df['Postcode'] \n",
  240. "coords = [ get_latlng(postal_code) for postal_code in postal_codes.tolist() ]"
  241. ]
  242. },
  243. {
  244. "cell_type": "code",
  245. "execution_count": 17,
  246. "metadata": {},
  247. "outputs": [
  248. {
  249. "data": {
  250. "text/html": [
  251. "<div>\n",
  252. "<style scoped>\n",
  253. " .dataframe tbody tr th:only-of-type {\n",
  254. " vertical-align: middle;\n",
  255. " }\n",
  256. "\n",
  257. " .dataframe tbody tr th {\n",
  258. " vertical-align: top;\n",
  259. " }\n",
  260. "\n",
  261. " .dataframe thead th {\n",
  262. " text-align: right;\n",
  263. " }\n",
  264. "</style>\n",
  265. "<table border=\"1\" class=\"dataframe\">\n",
  266. " <thead>\n",
  267. " <tr style=\"text-align: right;\">\n",
  268. " <th></th>\n",
  269. " <th>Postcode</th>\n",
  270. " <th>Borough</th>\n",
  271. " <th>Neighbourhood</th>\n",
  272. " <th>Latitude</th>\n",
  273. " <th>Longitude</th>\n",
  274. " </tr>\n",
  275. " </thead>\n",
  276. " <tbody>\n",
  277. " <tr>\n",
  278. " <th>0</th>\n",
  279. " <td>M1B</td>\n",
  280. " <td>Scarborough</td>\n",
  281. " <td>Rouge,Malvern</td>\n",
  282. " <td>43.811525</td>\n",
  283. " <td>-79.195517</td>\n",
  284. " </tr>\n",
  285. " <tr>\n",
  286. " <th>1</th>\n",
  287. " <td>M1C</td>\n",
  288. " <td>Scarborough</td>\n",
  289. " <td>Highland Creek,Rouge Hill,Port Union</td>\n",
  290. " <td>43.785730</td>\n",
  291. " <td>-79.158750</td>\n",
  292. " </tr>\n",
  293. " <tr>\n",
  294. " <th>2</th>\n",
  295. " <td>M1E</td>\n",
  296. " <td>Scarborough</td>\n",
  297. " <td>Guildwood,Morningside,West Hill</td>\n",
  298. " <td>43.765690</td>\n",
  299. " <td>-79.175256</td>\n",
  300. " </tr>\n",
  301. " <tr>\n",
  302. " <th>3</th>\n",
  303. " <td>M1G</td>\n",
  304. " <td>Scarborough</td>\n",
  305. " <td>Woburn</td>\n",
  306. " <td>43.768359</td>\n",
  307. " <td>-79.217590</td>\n",
  308. " </tr>\n",
  309. " <tr>\n",
  310. " <th>4</th>\n",
  311. " <td>M1H</td>\n",
  312. " <td>Scarborough</td>\n",
  313. " <td>Cedarbrae</td>\n",
  314. " <td>43.769688</td>\n",
  315. " <td>-79.239440</td>\n",
  316. " </tr>\n",
  317. " </tbody>\n",
  318. "</table>\n",
  319. "</div>"
  320. ],
  321. "text/plain": [
  322. " Postcode Borough Neighbourhood Latitude \\\n",
  323. "0 M1B Scarborough Rouge,Malvern 43.811525 \n",
  324. "1 M1C Scarborough Highland Creek,Rouge Hill,Port Union 43.785730 \n",
  325. "2 M1E Scarborough Guildwood,Morningside,West Hill 43.765690 \n",
  326. "3 M1G Scarborough Woburn 43.768359 \n",
  327. "4 M1H Scarborough Cedarbrae 43.769688 \n",
  328. "\n",
  329. " Longitude \n",
  330. "0 -79.195517 \n",
  331. "1 -79.158750 \n",
  332. "2 -79.175256 \n",
  333. "3 -79.217590 \n",
  334. "4 -79.239440 "
  335. ]
  336. },
  337. "execution_count": 17,
  338. "metadata": {},
  339. "output_type": "execute_result"
  340. }
  341. ],
  342. "source": [
  343. "df_coords = pd.DataFrame(coords, columns=['Latitude', 'Longitude'])\n",
  344. "df['Latitude'] = df_coords['Latitude']\n",
  345. "df['Longitude'] = df_coords['Longitude']\n",
  346. "df.head()"
  347. ]
  348. },
  349. {
  350. "cell_type": "code",
  351. "execution_count": 20,
  352. "metadata": {},
  353. "outputs": [
  354. {
  355. "data": {
  356. "text/html": [
  357. "<div>\n",
  358. "<style scoped>\n",
  359. " .dataframe tbody tr th:only-of-type {\n",
  360. " vertical-align: middle;\n",
  361. " }\n",
  362. "\n",
  363. " .dataframe tbody tr th {\n",
  364. " vertical-align: top;\n",
  365. " }\n",
  366. "\n",
  367. " .dataframe thead th {\n",
  368. " text-align: right;\n",
  369. " }\n",
  370. "</style>\n",
  371. "<table border=\"1\" class=\"dataframe\">\n",
  372. " <thead>\n",
  373. " <tr style=\"text-align: right;\">\n",
  374. " <th></th>\n",
  375. " <th>Postcode</th>\n",
  376. " <th>Borough</th>\n",
  377. " <th>Neighbourhood</th>\n",
  378. " <th>Latitude</th>\n",
  379. " <th>Longitude</th>\n",
  380. " </tr>\n",
  381. " </thead>\n",
  382. " <tbody>\n",
  383. " <tr>\n",
  384. " <th>57</th>\n",
  385. " <td>M5G</td>\n",
  386. " <td>Downtown Toronto</td>\n",
  387. " <td>Central Bay Street</td>\n",
  388. " <td>43.656091</td>\n",
  389. " <td>-79.38493</td>\n",
  390. " </tr>\n",
  391. " </tbody>\n",
  392. "</table>\n",
  393. "</div>"
  394. ],
  395. "text/plain": [
  396. " Postcode Borough Neighbourhood Latitude Longitude\n",
  397. "57 M5G Downtown Toronto Central Bay Street 43.656091 -79.38493"
  398. ]
  399. },
  400. "execution_count": 20,
  401. "metadata": {},
  402. "output_type": "execute_result"
  403. }
  404. ],
  405. "source": [
  406. "df[df.Postcode == 'M5G']"
  407. ]
  408. },
  409. {
  410. "cell_type": "code",
  411. "execution_count": 21,
  412. "metadata": {},
  413. "outputs": [],
  414. "source": [
  415. "df.to_csv('task2.csv', index=False)"
  416. ]
  417. },
  418. {
  419. "cell_type": "code",
  420. "execution_count": 22,
  421. "metadata": {},
  422. "outputs": [
  423. {
  424. "data": {
  425. "text/html": [
  426. "<div>\n",
  427. "<style scoped>\n",
  428. " .dataframe tbody tr th:only-of-type {\n",
  429. " vertical-align: middle;\n",
  430. " }\n",
  431. "\n",
  432. " .dataframe tbody tr th {\n",
  433. " vertical-align: top;\n",
  434. " }\n",
  435. "\n",
  436. " .dataframe thead th {\n",
  437. " text-align: right;\n",
  438. " }\n",
  439. "</style>\n",
  440. "<table border=\"1\" class=\"dataframe\">\n",
  441. " <thead>\n",
  442. " <tr style=\"text-align: right;\">\n",
  443. " <th></th>\n",
  444. " <th>Postcode</th>\n",
  445. " <th>Borough</th>\n",
  446. " <th>Neighbourhood</th>\n",
  447. " <th>Latitude</th>\n",
  448. " <th>Longitude</th>\n",
  449. " </tr>\n",
  450. " </thead>\n",
  451. " <tbody>\n",
  452. " <tr>\n",
  453. " <th>0</th>\n",
  454. " <td>M1B</td>\n",
  455. " <td>Scarborough</td>\n",
  456. " <td>Rouge,Malvern</td>\n",
  457. " <td>43.811525</td>\n",
  458. " <td>-79.195517</td>\n",
  459. " </tr>\n",
  460. " <tr>\n",
  461. " <th>1</th>\n",
  462. " <td>M1C</td>\n",
  463. " <td>Scarborough</td>\n",
  464. " <td>Highland Creek,Rouge Hill,Port Union</td>\n",
  465. " <td>43.785730</td>\n",
  466. " <td>-79.158750</td>\n",
  467. " </tr>\n",
  468. " <tr>\n",
  469. " <th>2</th>\n",
  470. " <td>M1E</td>\n",
  471. " <td>Scarborough</td>\n",
  472. " <td>Guildwood,Morningside,West Hill</td>\n",
  473. " <td>43.765690</td>\n",
  474. " <td>-79.175256</td>\n",
  475. " </tr>\n",
  476. " <tr>\n",
  477. " <th>3</th>\n",
  478. " <td>M1G</td>\n",
  479. " <td>Scarborough</td>\n",
  480. " <td>Woburn</td>\n",
  481. " <td>43.768359</td>\n",
  482. " <td>-79.217590</td>\n",
  483. " </tr>\n",
  484. " <tr>\n",
  485. " <th>4</th>\n",
  486. " <td>M1H</td>\n",
  487. " <td>Scarborough</td>\n",
  488. " <td>Cedarbrae</td>\n",
  489. " <td>43.769688</td>\n",
  490. " <td>-79.239440</td>\n",
  491. " </tr>\n",
  492. " <tr>\n",
  493. " <th>5</th>\n",
  494. " <td>M1J</td>\n",
  495. " <td>Scarborough</td>\n",
  496. " <td>Scarborough Village</td>\n",
  497. " <td>43.743125</td>\n",
  498. " <td>-79.231750</td>\n",
  499. " </tr>\n",
  500. " <tr>\n",
  501. " <th>6</th>\n",
  502. " <td>M1K</td>\n",
  503. " <td>Scarborough</td>\n",
  504. " <td>East Birchmount Park,Ionview,Kennedy Park</td>\n",
  505. " <td>43.726245</td>\n",
  506. " <td>-79.263670</td>\n",
  507. " </tr>\n",
  508. " <tr>\n",
  509. " <th>7</th>\n",
  510. " <td>M1L</td>\n",
  511. " <td>Scarborough</td>\n",
  512. " <td>Clairlea,Golden Mile,Oakridge</td>\n",
  513. " <td>43.713133</td>\n",
  514. " <td>-79.285055</td>\n",
  515. " </tr>\n",
  516. " <tr>\n",
  517. " <th>8</th>\n",
  518. " <td>M1M</td>\n",
  519. " <td>Scarborough</td>\n",
  520. " <td>Cliffcrest,Cliffside,Scarborough Village West</td>\n",
  521. " <td>43.723575</td>\n",
  522. " <td>-79.234976</td>\n",
  523. " </tr>\n",
  524. " <tr>\n",
  525. " <th>9</th>\n",
  526. " <td>M1N</td>\n",
  527. " <td>Scarborough</td>\n",
  528. " <td>Birch Cliff,Cliffside West</td>\n",
  529. " <td>43.696665</td>\n",
  530. " <td>-79.260163</td>\n",
  531. " </tr>\n",
  532. " <tr>\n",
  533. " <th>10</th>\n",
  534. " <td>M1P</td>\n",
  535. " <td>Scarborough</td>\n",
  536. " <td>Dorset Park,Scarborough Town Centre,Wexford He...</td>\n",
  537. " <td>43.759975</td>\n",
  538. " <td>-79.268974</td>\n",
  539. " </tr>\n",
  540. " <tr>\n",
  541. " <th>11</th>\n",
  542. " <td>M1R</td>\n",
  543. " <td>Scarborough</td>\n",
  544. " <td>Maryvale,Wexford</td>\n",
  545. " <td>43.750710</td>\n",
  546. " <td>-79.300560</td>\n",
  547. " </tr>\n",
  548. " <tr>\n",
  549. " <th>12</th>\n",
  550. " <td>M1S</td>\n",
  551. " <td>Scarborough</td>\n",
  552. " <td>Agincourt</td>\n",
  553. " <td>43.793940</td>\n",
  554. " <td>-79.267983</td>\n",
  555. " </tr>\n",
  556. " <tr>\n",
  557. " <th>13</th>\n",
  558. " <td>M1T</td>\n",
  559. " <td>Scarborough</td>\n",
  560. " <td>Clarks Corners,Sullivan,Tam O'Shanter</td>\n",
  561. " <td>43.784725</td>\n",
  562. " <td>-79.299047</td>\n",
  563. " </tr>\n",
  564. " <tr>\n",
  565. " <th>14</th>\n",
  566. " <td>M1V</td>\n",
  567. " <td>Scarborough</td>\n",
  568. " <td>Agincourt North,L'Amoreaux East,Milliken,Steel...</td>\n",
  569. " <td>43.817810</td>\n",
  570. " <td>-79.280244</td>\n",
  571. " </tr>\n",
  572. " <tr>\n",
  573. " <th>15</th>\n",
  574. " <td>M1W</td>\n",
  575. " <td>Scarborough</td>\n",
  576. " <td>L'Amoreaux West</td>\n",
  577. " <td>43.800881</td>\n",
  578. " <td>-79.320740</td>\n",
  579. " </tr>\n",
  580. " <tr>\n",
  581. " <th>16</th>\n",
  582. " <td>M1X</td>\n",
  583. " <td>Scarborough</td>\n",
  584. " <td>Upper Rouge</td>\n",
  585. " <td>43.834215</td>\n",
  586. " <td>-79.216701</td>\n",
  587. " </tr>\n",
  588. " <tr>\n",
  589. " <th>17</th>\n",
  590. " <td>M2H</td>\n",
  591. " <td>North York</td>\n",
  592. " <td>Hillcrest Village</td>\n",
  593. " <td>43.802845</td>\n",
  594. " <td>-79.356236</td>\n",
  595. " </tr>\n",
  596. " <tr>\n",
  597. " <th>18</th>\n",
  598. " <td>M2J</td>\n",
  599. " <td>North York</td>\n",
  600. " <td>Fairview,Henry Farm,Oriole</td>\n",
  601. " <td>43.780880</td>\n",
  602. " <td>-79.347796</td>\n",
  603. " </tr>\n",
  604. " <tr>\n",
  605. " <th>19</th>\n",
  606. " <td>M2K</td>\n",
  607. " <td>North York</td>\n",
  608. " <td>Bayview Village</td>\n",
  609. " <td>43.781015</td>\n",
  610. " <td>-79.380542</td>\n",
  611. " </tr>\n",
  612. " <tr>\n",
  613. " <th>20</th>\n",
  614. " <td>M2L</td>\n",
  615. " <td>North York</td>\n",
  616. " <td>Silver Hills,York Mills</td>\n",
  617. " <td>43.757192</td>\n",
  618. " <td>-79.379865</td>\n",
  619. " </tr>\n",
  620. " <tr>\n",
  621. " <th>21</th>\n",
  622. " <td>M2M</td>\n",
  623. " <td>North York</td>\n",
  624. " <td>Newtonbrook,Willowdale</td>\n",
  625. " <td>43.791475</td>\n",
  626. " <td>-79.413605</td>\n",
  627. " </tr>\n",
  628. " <tr>\n",
  629. " <th>22</th>\n",
  630. " <td>M2N</td>\n",
  631. " <td>North York</td>\n",
  632. " <td>Willowdale South</td>\n",
  633. " <td>43.768165</td>\n",
  634. " <td>-79.407420</td>\n",
  635. " </tr>\n",
  636. " <tr>\n",
  637. " <th>23</th>\n",
  638. " <td>M2P</td>\n",
  639. " <td>North York</td>\n",
  640. " <td>York Mills West</td>\n",
  641. " <td>43.747855</td>\n",
  642. " <td>-79.400062</td>\n",
  643. " </tr>\n",
  644. " <tr>\n",
  645. " <th>24</th>\n",
  646. " <td>M2R</td>\n",
  647. " <td>North York</td>\n",
  648. " <td>Willowdale West</td>\n",
  649. " <td>43.777695</td>\n",
  650. " <td>-79.445797</td>\n",
  651. " </tr>\n",
  652. " <tr>\n",
  653. " <th>25</th>\n",
  654. " <td>M3A</td>\n",
  655. " <td>North York</td>\n",
  656. " <td>Parkwoods</td>\n",
  657. " <td>43.752440</td>\n",
  658. " <td>-79.329271</td>\n",
  659. " </tr>\n",
  660. " <tr>\n",
  661. " <th>26</th>\n",
  662. " <td>M3B</td>\n",
  663. " <td>North York</td>\n",
  664. " <td>Don Mills North</td>\n",
  665. " <td>43.749195</td>\n",
  666. " <td>-79.361905</td>\n",
  667. " </tr>\n",
  668. " <tr>\n",
  669. " <th>27</th>\n",
  670. " <td>M3C</td>\n",
  671. " <td>North York</td>\n",
  672. " <td>Flemingdon Park,Don Mills South</td>\n",
  673. " <td>43.721425</td>\n",
  674. " <td>-79.343453</td>\n",
  675. " </tr>\n",
  676. " <tr>\n",
  677. " <th>28</th>\n",
  678. " <td>M3H</td>\n",
  679. " <td>North York</td>\n",
  680. " <td>Bathurst Manor,Downsview North,Wilson Heights</td>\n",
  681. " <td>43.757565</td>\n",
  682. " <td>-79.448191</td>\n",
  683. " </tr>\n",
  684. " <tr>\n",
  685. " <th>29</th>\n",
  686. " <td>M3J</td>\n",
  687. " <td>North York</td>\n",
  688. " <td>Northwood Park,York University</td>\n",
  689. " <td>43.764665</td>\n",
  690. " <td>-79.487183</td>\n",
  691. " </tr>\n",
  692. " <tr>\n",
  693. " <th>...</th>\n",
  694. " <td>...</td>\n",
  695. " <td>...</td>\n",
  696. " <td>...</td>\n",
  697. " <td>...</td>\n",
  698. " <td>...</td>\n",
  699. " </tr>\n",
  700. " <tr>\n",
  701. " <th>73</th>\n",
  702. " <td>M6C</td>\n",
  703. " <td>York</td>\n",
  704. " <td>Humewood-Cedarvale</td>\n",
  705. " <td>43.692105</td>\n",
  706. " <td>-79.430355</td>\n",
  707. " </tr>\n",
  708. " <tr>\n",
  709. " <th>74</th>\n",
  710. " <td>M6E</td>\n",
  711. " <td>York</td>\n",
  712. " <td>Caledonia-Fairbanks</td>\n",
  713. " <td>43.688640</td>\n",
  714. " <td>-79.451015</td>\n",
  715. " </tr>\n",
  716. " <tr>\n",
  717. " <th>75</th>\n",
  718. " <td>M6G</td>\n",
  719. " <td>Downtown Toronto</td>\n",
  720. " <td>Christie</td>\n",
  721. " <td>43.668781</td>\n",
  722. " <td>-79.420710</td>\n",
  723. " </tr>\n",
  724. " <tr>\n",
  725. " <th>76</th>\n",
  726. " <td>M6H</td>\n",
  727. " <td>West Toronto</td>\n",
  728. " <td>Dovercourt Village,Dufferin</td>\n",
  729. " <td>43.665087</td>\n",
  730. " <td>-79.438705</td>\n",
  731. " </tr>\n",
  732. " <tr>\n",
  733. " <th>77</th>\n",
  734. " <td>M6J</td>\n",
  735. " <td>West Toronto</td>\n",
  736. " <td>Little Portugal,Trinity</td>\n",
  737. " <td>43.648485</td>\n",
  738. " <td>-79.417742</td>\n",
  739. " </tr>\n",
  740. " <tr>\n",
  741. " <th>78</th>\n",
  742. " <td>M6K</td>\n",
  743. " <td>West Toronto</td>\n",
  744. " <td>Brockton,Exhibition Place,Parkdale Village</td>\n",
  745. " <td>43.639410</td>\n",
  746. " <td>-79.424362</td>\n",
  747. " </tr>\n",
  748. " <tr>\n",
  749. " <th>79</th>\n",
  750. " <td>M6L</td>\n",
  751. " <td>North York</td>\n",
  752. " <td>Downsview,North Park,Upwood Park</td>\n",
  753. " <td>43.713810</td>\n",
  754. " <td>-79.488305</td>\n",
  755. " </tr>\n",
  756. " <tr>\n",
  757. " <th>80</th>\n",
  758. " <td>M6M</td>\n",
  759. " <td>York</td>\n",
  760. " <td>Del Ray,Keelesdale,Mount Dennis,Silverthorn</td>\n",
  761. " <td>43.694545</td>\n",
  762. " <td>-79.484643</td>\n",
  763. " </tr>\n",
  764. " <tr>\n",
  765. " <th>81</th>\n",
  766. " <td>M6N</td>\n",
  767. " <td>York</td>\n",
  768. " <td>The Junction North,Runnymede</td>\n",
  769. " <td>43.675825</td>\n",
  770. " <td>-79.482052</td>\n",
  771. " </tr>\n",
  772. " <tr>\n",
  773. " <th>82</th>\n",
  774. " <td>M6P</td>\n",
  775. " <td>West Toronto</td>\n",
  776. " <td>High Park,The Junction South</td>\n",
  777. " <td>43.659975</td>\n",
  778. " <td>-79.462874</td>\n",
  779. " </tr>\n",
  780. " <tr>\n",
  781. " <th>83</th>\n",
  782. " <td>M6R</td>\n",
  783. " <td>West Toronto</td>\n",
  784. " <td>Parkdale,Roncesvalles</td>\n",
  785. " <td>43.647870</td>\n",
  786. " <td>-79.449762</td>\n",
  787. " </tr>\n",
  788. " <tr>\n",
  789. " <th>84</th>\n",
  790. " <td>M6S</td>\n",
  791. " <td>West Toronto</td>\n",
  792. " <td>Runnymede,Swansea</td>\n",
  793. " <td>43.649885</td>\n",
  794. " <td>-79.474929</td>\n",
  795. " </tr>\n",
  796. " <tr>\n",
  797. " <th>85</th>\n",
  798. " <td>M7A</td>\n",
  799. " <td>Queen's Park</td>\n",
  800. " <td>Not assigned</td>\n",
  801. " <td>43.661102</td>\n",
  802. " <td>-79.391035</td>\n",
  803. " </tr>\n",
  804. " <tr>\n",
  805. " <th>86</th>\n",
  806. " <td>M7R</td>\n",
  807. " <td>Mississauga</td>\n",
  808. " <td>Canada Post Gateway Processing Centre</td>\n",
  809. " <td>43.648690</td>\n",
  810. " <td>-79.385440</td>\n",
  811. " </tr>\n",
  812. " <tr>\n",
  813. " <th>87</th>\n",
  814. " <td>M7Y</td>\n",
  815. " <td>East Toronto</td>\n",
  816. " <td>Business Reply Mail Processing Centre 969 Eastern</td>\n",
  817. " <td>43.648690</td>\n",
  818. " <td>-79.385440</td>\n",
  819. " </tr>\n",
  820. " <tr>\n",
  821. " <th>88</th>\n",
  822. " <td>M8V</td>\n",
  823. " <td>Etobicoke</td>\n",
  824. " <td>Humber Bay Shores,Mimico South,New Toronto</td>\n",
  825. " <td>43.609870</td>\n",
  826. " <td>-79.498178</td>\n",
  827. " </tr>\n",
  828. " <tr>\n",
  829. " <th>89</th>\n",
  830. " <td>M8W</td>\n",
  831. " <td>Etobicoke</td>\n",
  832. " <td>Alderwood,Long Branch</td>\n",
  833. " <td>43.601131</td>\n",
  834. " <td>-79.538785</td>\n",
  835. " </tr>\n",
  836. " <tr>\n",
  837. " <th>90</th>\n",
  838. " <td>M8X</td>\n",
  839. " <td>Etobicoke</td>\n",
  840. " <td>The Kingsway,Montgomery Road,Old Mill North</td>\n",
  841. " <td>43.653690</td>\n",
  842. " <td>-79.511117</td>\n",
  843. " </tr>\n",
  844. " <tr>\n",
  845. " <th>91</th>\n",
  846. " <td>M8Y</td>\n",
  847. " <td>Etobicoke</td>\n",
  848. " <td>Humber Bay,King's Mill Park,Kingsway Park Sout...</td>\n",
  849. " <td>43.632765</td>\n",
  850. " <td>-79.489601</td>\n",
  851. " </tr>\n",
  852. " <tr>\n",
  853. " <th>92</th>\n",
  854. " <td>M8Z</td>\n",
  855. " <td>Etobicoke</td>\n",
  856. " <td>Kingsway Park South West,Mimico NW,The Queensw...</td>\n",
  857. " <td>43.624630</td>\n",
  858. " <td>-79.526950</td>\n",
  859. " </tr>\n",
  860. " <tr>\n",
  861. " <th>93</th>\n",
  862. " <td>M9A</td>\n",
  863. " <td>Etobicoke</td>\n",
  864. " <td>Islington Avenue</td>\n",
  865. " <td>43.662242</td>\n",
  866. " <td>-79.528379</td>\n",
  867. " </tr>\n",
  868. " <tr>\n",
  869. " <th>94</th>\n",
  870. " <td>M9B</td>\n",
  871. " <td>Etobicoke</td>\n",
  872. " <td>Cloverdale,Islington,Martin Grove,Princess Gar...</td>\n",
  873. " <td>43.649692</td>\n",
  874. " <td>-79.553945</td>\n",
  875. " </tr>\n",
  876. " <tr>\n",
  877. " <th>95</th>\n",
  878. " <td>M9C</td>\n",
  879. " <td>Etobicoke</td>\n",
  880. " <td>Bloordale Gardens,Eringate,Markland Wood,Old B...</td>\n",
  881. " <td>43.648573</td>\n",
  882. " <td>-79.578250</td>\n",
  883. " </tr>\n",
  884. " <tr>\n",
  885. " <th>96</th>\n",
  886. " <td>M9L</td>\n",
  887. " <td>North York</td>\n",
  888. " <td>Humber Summit</td>\n",
  889. " <td>43.759500</td>\n",
  890. " <td>-79.556852</td>\n",
  891. " </tr>\n",
  892. " <tr>\n",
  893. " <th>97</th>\n",
  894. " <td>M9M</td>\n",
  895. " <td>North York</td>\n",
  896. " <td>Emery,Humberlea</td>\n",
  897. " <td>43.733760</td>\n",
  898. " <td>-79.537522</td>\n",
  899. " </tr>\n",
  900. " <tr>\n",
  901. " <th>98</th>\n",
  902. " <td>M9N</td>\n",
  903. " <td>York</td>\n",
  904. " <td>Weston</td>\n",
  905. " <td>43.704855</td>\n",
  906. " <td>-79.517552</td>\n",
  907. " </tr>\n",
  908. " <tr>\n",
  909. " <th>99</th>\n",
  910. " <td>M9P</td>\n",
  911. " <td>Etobicoke</td>\n",
  912. " <td>Westmount</td>\n",
  913. " <td>43.696300</td>\n",
  914. " <td>-79.530399</td>\n",
  915. " </tr>\n",
  916. " <tr>\n",
  917. " <th>100</th>\n",
  918. " <td>M9R</td>\n",
  919. " <td>Etobicoke</td>\n",
  920. " <td>Kingsview Village,Martin Grove Gardens,Richvie...</td>\n",
  921. " <td>43.686915</td>\n",
  922. " <td>-79.557276</td>\n",
  923. " </tr>\n",
  924. " <tr>\n",
  925. " <th>101</th>\n",
  926. " <td>M9V</td>\n",
  927. " <td>Etobicoke</td>\n",
  928. " <td>Albion Gardens,Beaumond Heights,Humbergate,Jam...</td>\n",
  929. " <td>43.743205</td>\n",
  930. " <td>-79.584701</td>\n",
  931. " </tr>\n",
  932. " <tr>\n",
  933. " <th>102</th>\n",
  934. " <td>M9W</td>\n",
  935. " <td>Etobicoke</td>\n",
  936. " <td>Northwest</td>\n",
  937. " <td>43.711740</td>\n",
  938. " <td>-79.579181</td>\n",
  939. " </tr>\n",
  940. " </tbody>\n",
  941. "</table>\n",
  942. "<p>103 rows × 5 columns</p>\n",
  943. "</div>"
  944. ],
  945. "text/plain": [
  946. " Postcode Borough \\\n",
  947. "0 M1B Scarborough \n",
  948. "1 M1C Scarborough \n",
  949. "2 M1E Scarborough \n",
  950. "3 M1G Scarborough \n",
  951. "4 M1H Scarborough \n",
  952. "5 M1J Scarborough \n",
  953. "6 M1K Scarborough \n",
  954. "7 M1L Scarborough \n",
  955. "8 M1M Scarborough \n",
  956. "9 M1N Scarborough \n",
  957. "10 M1P Scarborough \n",
  958. "11 M1R Scarborough \n",
  959. "12 M1S Scarborough \n",
  960. "13 M1T Scarborough \n",
  961. "14 M1V Scarborough \n",
  962. "15 M1W Scarborough \n",
  963. "16 M1X Scarborough \n",
  964. "17 M2H North York \n",
  965. "18 M2J North York \n",
  966. "19 M2K North York \n",
  967. "20 M2L North York \n",
  968. "21 M2M North York \n",
  969. "22 M2N North York \n",
  970. "23 M2P North York \n",
  971. "24 M2R North York \n",
  972. "25 M3A North York \n",
  973. "26 M3B North York \n",
  974. "27 M3C North York \n",
  975. "28 M3H North York \n",
  976. "29 M3J North York \n",
  977. ".. ... ... \n",
  978. "73 M6C York \n",
  979. "74 M6E York \n",
  980. "75 M6G Downtown Toronto \n",
  981. "76 M6H West Toronto \n",
  982. "77 M6J West Toronto \n",
  983. "78 M6K West Toronto \n",
  984. "79 M6L North York \n",
  985. "80 M6M York \n",
  986. "81 M6N York \n",
  987. "82 M6P West Toronto \n",
  988. "83 M6R West Toronto \n",
  989. "84 M6S West Toronto \n",
  990. "85 M7A Queen's Park \n",
  991. "86 M7R Mississauga \n",
  992. "87 M7Y East Toronto \n",
  993. "88 M8V Etobicoke \n",
  994. "89 M8W Etobicoke \n",
  995. "90 M8X Etobicoke \n",
  996. "91 M8Y Etobicoke \n",
  997. "92 M8Z Etobicoke \n",
  998. "93 M9A Etobicoke \n",
  999. "94 M9B Etobicoke \n",
  1000. "95 M9C Etobicoke \n",
  1001. "96 M9L North York \n",
  1002. "97 M9M North York \n",
  1003. "98 M9N York \n",
  1004. "99 M9P Etobicoke \n",
  1005. "100 M9R Etobicoke \n",
  1006. "101 M9V Etobicoke \n",
  1007. "102 M9W Etobicoke \n",
  1008. "\n",
  1009. " Neighbourhood Latitude Longitude \n",
  1010. "0 Rouge,Malvern 43.811525 -79.195517 \n",
  1011. "1 Highland Creek,Rouge Hill,Port Union 43.785730 -79.158750 \n",
  1012. "2 Guildwood,Morningside,West Hill 43.765690 -79.175256 \n",
  1013. "3 Woburn 43.768359 -79.217590 \n",
  1014. "4 Cedarbrae 43.769688 -79.239440 \n",
  1015. "5 Scarborough Village 43.743125 -79.231750 \n",
  1016. "6 East Birchmount Park,Ionview,Kennedy Park 43.726245 -79.263670 \n",
  1017. "7 Clairlea,Golden Mile,Oakridge 43.713133 -79.285055 \n",
  1018. "8 Cliffcrest,Cliffside,Scarborough Village West 43.723575 -79.234976 \n",
  1019. "9 Birch Cliff,Cliffside West 43.696665 -79.260163 \n",
  1020. "10 Dorset Park,Scarborough Town Centre,Wexford He... 43.759975 -79.268974 \n",
  1021. "11 Maryvale,Wexford 43.750710 -79.300560 \n",
  1022. "12 Agincourt 43.793940 -79.267983 \n",
  1023. "13 Clarks Corners,Sullivan,Tam O'Shanter 43.784725 -79.299047 \n",
  1024. "14 Agincourt North,L'Amoreaux East,Milliken,Steel... 43.817810 -79.280244 \n",
  1025. "15 L'Amoreaux West 43.800881 -79.320740 \n",
  1026. "16 Upper Rouge 43.834215 -79.216701 \n",
  1027. "17 Hillcrest Village 43.802845 -79.356236 \n",
  1028. "18 Fairview,Henry Farm,Oriole 43.780880 -79.347796 \n",
  1029. "19 Bayview Village 43.781015 -79.380542 \n",
  1030. "20 Silver Hills,York Mills 43.757192 -79.379865 \n",
  1031. "21 Newtonbrook,Willowdale 43.791475 -79.413605 \n",
  1032. "22 Willowdale South 43.768165 -79.407420 \n",
  1033. "23 York Mills West 43.747855 -79.400062 \n",
  1034. "24 Willowdale West 43.777695 -79.445797 \n",
  1035. "25 Parkwoods 43.752440 -79.329271 \n",
  1036. "26 Don Mills North 43.749195 -79.361905 \n",
  1037. "27 Flemingdon Park,Don Mills South 43.721425 -79.343453 \n",
  1038. "28 Bathurst Manor,Downsview North,Wilson Heights 43.757565 -79.448191 \n",
  1039. "29 Northwood Park,York University 43.764665 -79.487183 \n",
  1040. ".. ... ... ... \n",
  1041. "73 Humewood-Cedarvale 43.692105 -79.430355 \n",
  1042. "74 Caledonia-Fairbanks 43.688640 -79.451015 \n",
  1043. "75 Christie 43.668781 -79.420710 \n",
  1044. "76 Dovercourt Village,Dufferin 43.665087 -79.438705 \n",
  1045. "77 Little Portugal,Trinity 43.648485 -79.417742 \n",
  1046. "78 Brockton,Exhibition Place,Parkdale Village 43.639410 -79.424362 \n",
  1047. "79 Downsview,North Park,Upwood Park 43.713810 -79.488305 \n",
  1048. "80 Del Ray,Keelesdale,Mount Dennis,Silverthorn 43.694545 -79.484643 \n",
  1049. "81 The Junction North,Runnymede 43.675825 -79.482052 \n",
  1050. "82 High Park,The Junction South 43.659975 -79.462874 \n",
  1051. "83 Parkdale,Roncesvalles 43.647870 -79.449762 \n",
  1052. "84 Runnymede,Swansea 43.649885 -79.474929 \n",
  1053. "85 Not assigned 43.661102 -79.391035 \n",
  1054. "86 Canada Post Gateway Processing Centre 43.648690 -79.385440 \n",
  1055. "87 Business Reply Mail Processing Centre 969 Eastern 43.648690 -79.385440 \n",
  1056. "88 Humber Bay Shores,Mimico South,New Toronto 43.609870 -79.498178 \n",
  1057. "89 Alderwood,Long Branch 43.601131 -79.538785 \n",
  1058. "90 The Kingsway,Montgomery Road,Old Mill North 43.653690 -79.511117 \n",
  1059. "91 Humber Bay,King's Mill Park,Kingsway Park Sout... 43.632765 -79.489601 \n",
  1060. "92 Kingsway Park South West,Mimico NW,The Queensw... 43.624630 -79.526950 \n",
  1061. "93 Islington Avenue 43.662242 -79.528379 \n",
  1062. "94 Cloverdale,Islington,Martin Grove,Princess Gar... 43.649692 -79.553945 \n",
  1063. "95 Bloordale Gardens,Eringate,Markland Wood,Old B... 43.648573 -79.578250 \n",
  1064. "96 Humber Summit 43.759500 -79.556852 \n",
  1065. "97 Emery,Humberlea 43.733760 -79.537522 \n",
  1066. "98 Weston 43.704855 -79.517552 \n",
  1067. "99 Westmount 43.696300 -79.530399 \n",
  1068. "100 Kingsview Village,Martin Grove Gardens,Richvie... 43.686915 -79.557276 \n",
  1069. "101 Albion Gardens,Beaumond Heights,Humbergate,Jam... 43.743205 -79.584701 \n",
  1070. "102 Northwest 43.711740 -79.579181 \n",
  1071. "\n",
  1072. "[103 rows x 5 columns]"
  1073. ]
  1074. },
  1075. "execution_count": 22,
  1076. "metadata": {},
  1077. "output_type": "execute_result"
  1078. }
  1079. ],
  1080. "source": [
  1081. "df"
  1082. ]
  1083. },
  1084. {
  1085. "cell_type": "code",
  1086. "execution_count": null,
  1087. "metadata": {},
  1088. "outputs": [],
  1089. "source": []
  1090. }
  1091. ],
  1092. "metadata": {
  1093. "kernelspec": {
  1094. "display_name": "Python 3",
  1095. "language": "python",
  1096. "name": "python3"
  1097. },
  1098. "language_info": {
  1099. "codemirror_mode": {
  1100. "name": "ipython",
  1101. "version": 3
  1102. },
  1103. "file_extension": ".py",
  1104. "mimetype": "text/x-python",
  1105. "name": "python",
  1106. "nbconvert_exporter": "python",
  1107. "pygments_lexer": "ipython3",
  1108. "version": "3.6.7"
  1109. }
  1110. },
  1111. "nbformat": 4,
  1112. "nbformat_minor": 4
  1113. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement