{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# `regex` workflow" ] }, { "cell_type": "code", "execution_count": 6, "metadata": {}, "outputs": [], "source": [ "%reload_ext autoreload\n", "%autoreload 2\n", "%matplotlib inline\n", "import pandas as pd\n", "import re" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### Jeremy Howard is the guest lecturer for Lesson 9!
\n", "\n", "#### In the video, he gives a three-part lesson plan: \n", " * regex workflow\n", " * svd\n", " * transfer learning. \n", " \n", "Jeremy mentions that he uses `regex` every day in his work, and that it is essential for machine learning practitioners to develop a working knowledge of `regex`. Since we've already done deep dives into `svd` and into `transfer learning`, we'll focus on the `regex` part of this video, `from 1:50 to 21:29`." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "### A simple `regex` exercise\n", "#### To illustrate the power of `regex` and familiarize us with the way he works, Jeremy poses the following problem:
Let's extract all the phone numbers from the Austin Public Health Locations database and create a list of the phone numbers in the standard format `(ddd) ddd dddd`. He shows how to use `vim` to accomplish this task.\n", "Let's listen to Jeremy for the next 20 minutes or so:" ] }, { "cell_type": "code", "execution_count": 53, "metadata": {}, "outputs": [ { "data": { "text/html": [ "" ], "text/plain": [ "" ] }, "execution_count": 53, "metadata": {}, "output_type": "execute_result" } ], "source": [ "from IPython.display import HTML\n", "\n", "# Play youtube video\n", "HTML('')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Some of the takeaways from the video, paraphrased:\n", "1. A neccessary but not sufficient condition for success
\n", "What is the greatest difference between people who succeed and people who do not? It's entirely about tenacity. If you are willing to focus on the task and keep trying you have a good chance of succeeding. \n", "\n", "2. Workflow
\n", "Work in an interactive environment, such as `vim`, or `jupyter notebook`, so you can try things get immediate feedback, revise, and progress toward a solution. \n", "\n", "3. Debugging
\n", "When your code fails, remember that the computer is doing exactly what you asked. A good general approach is to break the code up into smaller parts, then run it again, and find out which part doesn't work.\n", "\n", "4. Humility
\n", "It's never \"I think the problem in the code is X\". A better approach is to start with the working assumption \"I am an idiot, and I don't understand why things aren't working\". Be willing to start from scratch and check every little step." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### OK, let's get to work on our task. We'll use `jupyter notebook` as our interactive environment." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 1. Get the Austin Public Health Locations database\n", "#### https://data.austintexas.gov/Health-and-Community-Services/Austin-Public-Health-Locations/6v78-dj3u/data" ] }, { "cell_type": "code", "execution_count": 13, "metadata": {}, "outputs": [], "source": [ "path = 'C:/Users/cross-entropy/.fastai/data/Austin_Public_Health_Locations'" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Read the data into a pandas dataframe. \n", "From the `Phone Number` column, we see that the phone numbers are in the format `ddd-ddd-dddd`." ] }, { "cell_type": "code", "execution_count": 56, "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", " \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", " \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", " \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", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", " \n", "
Facility NameStreet AddressZip CodeHoursWebsitePhone NumberOther PhoneBuilding IDOwnership StatusOwnerOccupying DivisionOccupancy TypeSq. Ft.Year Built
0Bastrop WIC Clinic443 Texas Highway 71\\nBastrop, Texas 78602\\n(3...78602Monday 7:30am to 7pm, closed 12 noon to 1pm; T...NaN512-972-4942NaNBASLeaseThe Marketplace at BastropCommunity ServicesClinic1400.0NaN
1Vital Records7201 Levander Loop, Building C\\nAustin, Texas\\...78702Monday to Friday, 8am to 4:30pmhttps://austintexas.gov/birthcertificates512-972-4784NaNNaNNaNNaNNaNNaNNaNNaN
2Manor WIC Clinic600 West Carrie\\nManor, Texas 78653\\n(30.34016...78653Thursday 9am to 2:30pm, closed 12 noon to 12:30pmhttp://www.austintexas.gov/department/manor-wi...512-972-4942NaNMANNaNTravis CountyCommunity ServicesClinic1700.0NaN
3St. Johns WIC Clinic7500 Blessing Avenue\\nAustin, Texas 78752\\n(30...78752Monday and Tuesday 7:30 a.m. to 7 p.m., closed...http://www.austintexas.gov/department/st-johns...512-972-4942NaNSJCLeaseAustin Independent School CenterCommunity ServicesClinic, Neighborhood Center9559.02001.0
4Betty Dunkerley Health Campus Building B7201 Levander Loop\\nAustin, Texas 78702\\n(30.2...78702Sunday - Saturday 7:00am to 7:00pmNaN512-972-5010NaNBDCBOwnCity of AustinEpidemiology and Public Health Preparedness, O...Offices2190.0NaN
5Northwest WIC Clinic8701 Research Blvd, Suite A\\nAustin, Texas 787...78758Monday and Tuesday 7:30am to 7:00pm, closed 12...http://www.austintexas.gov/department/northwes...512-972-4942NaNNWWLeaseVan Family Real Estate Partnership, LtdCommunity ServicesClinic4200.01993.0
6Rutherford Campus1520 Rutherford Lane, Bldg 1\\nAustin, Texas 78...78754Monday and Wednesday 7:45am to 11:30am; Tuesda...https://austintexas.gov/department/environment...512-978-0300NaNRLCOwnCity of AustinEnvironmental Health ServicesOffices2500.0NaN
7Montopolis Recreation Community Center1200 Montopolis Dr.\\nAustin, Texas 78741\\n(30....78741Monday - Thursday: 11 AM - 9 PM, Friday 11 AM ...NaN12-978-2300NaNMRCCOwnCity of AustinCommunity ServicesOfficesNaNNaN
8Blackland Neighborhood Center2005 Salina St\\nAustin, Texas 78722\\n(30.28075...78722Monday to Thursday 8am to 6pm; Friday 8am to 1...NaN512-972-5790NaNBNCOwnCity of AustinCommunity ServicesNeighborhood Center, Offices347.01984.0
9Dove Springs WIC Center6801 South IH-35, Suite I & J\\nAustin, Texas 7...78744Monday and Tuesday 7:30am to 7:00pm, closed 12...http://www.austintexas.gov/department/dove-spr...512-972-4942NaNDOVLeaseLX-Northbluff Center, L.P.Community ServicesClinic2100.0NaN
10First Workers Day Labor Center4916 N IH 35\\nAustin, Texas 78751\\n(30.308436,...78751NaNhttp://www.austintexas.gov/online-form/first-w...512-972-4100NaNNaNLeaseNajib WebbeCommunity ServicesService Center5315.0NaN
11South Austin Neighborhood Center2508 Durwood St.\\nAustin, Texas 78704\\n(30.239...78704Monday to Thursday 8 a.m. to 6 p.m.; Friday 8 ...http://www.austintexas.gov/department/south-au...512-972-6840NaNSANOwnCity of AustinCommunity ServicesClinic, Neighborhood Services18651.01980.0
12Far South WIC Clinic405 W. Stassney Lane\\nAustin, Texas 78745\\n(30...78745Monday and Tuesday 7:30am to 7:00pm, closed 12...http://www.austintexas.gov/department/far-sout...512-972-4942NaNFSHOwnCity of AustinComunity Services, Disease Prevention and Heal...Clinic4750.01982.0
13Montopolis WIC Clinic2901 Montopolis Drive\\nAustin, Texas 78741\\n(3...78741Monday and Tuesday 8am to 7pm, closed 12 noon ...http://www.austintexas.gov/department/montopol...512-972-4942NaNMONLeaseCentralCommunity ServicesClinic1993.02015.0
14Clarksville Community Health Center1000 Toyath Street\\nAustin, Texas 78703\\n(30.2...78703Monday to Friday, 8am - 4:30pmhttp://www.austintexas.gov/department/clarksvi...NaNNaNCNCOwnCity of AustinDisease Prevnetion and Health PromotionClinic, Offices3500.0NaN
15RBJ Health Center15 Waller Street\\nAustin, Texas 78702\\n(30.252...78702Monday to Friday 8am to 5pmhttp://www.austintexas.gov/department/rbj-heal...512-972-5400NaNRBJOwnCity of AustinAdministrative Support Services, Disease Prevn...Clinic, Offices50809.01968.0
16South Austin WIC Clinic2508 Durwood St.\\nAustin, Texas 78704\\n(30.239...78704Monday and Tuesday 7:30am to 7:00 p.m., closed...http://www.austintexas.gov/department/south-au...512-972-4942NaNSANOwnCity of AustinCommunity ServicesClinic, Neighborhood Center18651.01980.0
17Betty Dunkerley Campus, Building E7201 Levander Loop, Building E\\nAustin, Texas ...78702NaNNaN512-972-5000NaNBDCEOwnCity of AustinAdministrative Support Services, Health Equity...Offices12403.0NaN
18Montopolis Neighborhood Center1416 Montopolis Drive\\nAustin, Texas 78741\\n(3...78741Tuesday 8am to noon and 1pm to 5pmhttp://www.austintexas.gov/department/montopol...512-962-6650NaNMNCOwnCity of AustinCommunity ServicesNeighborhood Center2840.01976.0
19East Austin WIC Clinic211 Comal St.\\nAustin, Texas 78702\\n(30.259745...78702Monday to Thursday 8am to 6pm; closed 12noon t...http://www.austintexas.gov/department/east-aus...512-972-4942NaNEANOwnCity of AustinCommunity ServicesClinic, Neighborhood Center4304.01981.0
20Del Valle WIC Clinic3518 FM 973\\nDel Valle, Texas 78617\\n(30.19879...78617Monday 8am to 7pm; closed 12 noon to 12:30pm; ...http://www.austintexas.gov/department/del-vall...512-972-4942NaNDELNaNTravis CountyCommunity ServicesClinic1000.0NaN
21Rosewood-Zaragosa Neighborhood Center2800 Webberville Road\\nAustin, Texas 78702\\n(3...78702Monday to Friday 8am to 6pm; Fridays 8am to noonhttp://www.austintexas.gov/department/rosewood...512-972-6740NaNRZNOwnCity of AustinCommunity ServicesClinic, Neighborhood Center17128.01974.0
22Pflugerville WIC Clinic15822 Foothill Farms Loop\\nPflugerville, Texas...78660Monday and Tuesday 7:30am to 7:00pm, closed 12...http://www.austintexas.gov/department/pflugerv...512-972-4942NaNPFLNaNTravis CountyCommunity ServicesClinic2000.0NaN
23Betty Dunkerley Health Campus, Building C7201 Levander Loop, Bulding C\\nAustin, Texas 7...78702NaNNaN512-972-5000NaNBDCCOwnCity of AustinCommunity Services, Epidemiology, Public Healt...Offices7448.0NaN
24Mom's Place - WIC Breastfeeding Resource Center8701 Research Blvd., Suite B\\nAustin, Texas 78...78758Monday, Wednesday, and Thursday 8am to 5pm, c...http://www.austintexas.gov/department/moms-pla...512-719-30101-800-514-6667MOMLeaseVan Family Real Estate Partnership, LtdCommunity ServicesClinic2080.01993.0
25AK Black Health Center928 Blackson Avenue\\nAustin, Texas 78752\\n(30....78752NaNNaN512-978-9740NaNAKBOwnCity of AustinCommunity Services, Health Equity and Communit...Clinic4200.0NaN
26St. John Community Center7500 Blessing Avenue\\nAustin, Texas 78752\\n(30...78752Monday to Thursday 8 a.m. – 6 p.m.; Friday 8...http://www.austintexas.gov/department/st-johns...512-972-5139NaNSJCLeaseAustin Independent School DistrictCommunity ServicesClinic, Neighborhood Center9559.02001.0
27Elgin WIC Clinic218 South Main Street\\nElgin, Texas 78621\\n(30...78621Tuesdays 8:00am to 5:00pm, closed 12 noon to 1...http://www.austintexas.gov/department/elgin-wi...512-972-4942NaNELGNaNTravis CountyCommunity ServicesClinic1500.0NaN
28Betty Dunkerley Campus Building H, Administrat...7201 Levander Loop, Building H\\nAustin, Texas ...78702NaNNaNNaNNaNBDCHOwnCity of AustinAdministrative Support Services, Community Ser...Offices10016.0NaN
29Rosewood-Zaragosa WIC Clinic2800 Webberville Road\\nAustin, Texas 78702\\n(3...78702Monday and Tuesday 7:30am to 7:00pm, closed 12...http://www.austintexas.gov/department/rosewood...512-972-4942NaNRZNOwnCity of AustinCommunity ServicesClinic, Neighborhood Center17128.01974.0
30East Austin Neighborhood Center211 Comal St\\nAustin, Texas 78702\\n(30.259718,...78702Monday toThursday 8am to 6pm; Friday 8am to noonhttp://www.austintexas.gov/department/east-aus...512-972-6650NaNEANOwnCity of AustinCommunity ServicesClinic, Neighborhood Center4304.01981.0
31Oak Hill WIC Clinic8656 Hwy. 71 W, Building A Ste B\\nAustin, Texa...78735Monday 8am to 5pm, closed 12 noon to 12:30pmhttp://www.austintexas.gov/department/oak-hill...512-972-4942NaNOAKNaNTravis CountyCommunity ServicesClinic1200.0NaN
\n", "
" ], "text/plain": [ " Facility Name \\\n", "0 Bastrop WIC Clinic \n", "1 Vital Records \n", "2 Manor WIC Clinic \n", "3 St. Johns WIC Clinic \n", "4 Betty Dunkerley Health Campus Building B \n", "5 Northwest WIC Clinic \n", "6 Rutherford Campus \n", "7 Montopolis Recreation Community Center \n", "8 Blackland Neighborhood Center \n", "9 Dove Springs WIC Center \n", "10 First Workers Day Labor Center \n", "11 South Austin Neighborhood Center \n", "12 Far South WIC Clinic \n", "13 Montopolis WIC Clinic \n", "14 Clarksville Community Health Center \n", "15 RBJ Health Center \n", "16 South Austin WIC Clinic \n", "17 Betty Dunkerley Campus, Building E \n", "18 Montopolis Neighborhood Center \n", "19 East Austin WIC Clinic \n", "20 Del Valle WIC Clinic \n", "21 Rosewood-Zaragosa Neighborhood Center \n", "22 Pflugerville WIC Clinic \n", "23 Betty Dunkerley Health Campus, Building C \n", "24 Mom's Place - WIC Breastfeeding Resource Center \n", "25 AK Black Health Center \n", "26 St. John Community Center \n", "27 Elgin WIC Clinic \n", "28 Betty Dunkerley Campus Building H, Administrat... \n", "29 Rosewood-Zaragosa WIC Clinic \n", "30 East Austin Neighborhood Center \n", "31 Oak Hill WIC Clinic \n", "\n", " Street Address Zip Code \\\n", "0 443 Texas Highway 71\\nBastrop, Texas 78602\\n(3... 78602 \n", "1 7201 Levander Loop, Building C\\nAustin, Texas\\... 78702 \n", "2 600 West Carrie\\nManor, Texas 78653\\n(30.34016... 78653 \n", "3 7500 Blessing Avenue\\nAustin, Texas 78752\\n(30... 78752 \n", "4 7201 Levander Loop\\nAustin, Texas 78702\\n(30.2... 78702 \n", "5 8701 Research Blvd, Suite A\\nAustin, Texas 787... 78758 \n", "6 1520 Rutherford Lane, Bldg 1\\nAustin, Texas 78... 78754 \n", "7 1200 Montopolis Dr.\\nAustin, Texas 78741\\n(30.... 78741 \n", "8 2005 Salina St\\nAustin, Texas 78722\\n(30.28075... 78722 \n", "9 6801 South IH-35, Suite I & J\\nAustin, Texas 7... 78744 \n", "10 4916 N IH 35\\nAustin, Texas 78751\\n(30.308436,... 78751 \n", "11 2508 Durwood St.\\nAustin, Texas 78704\\n(30.239... 78704 \n", "12 405 W. Stassney Lane\\nAustin, Texas 78745\\n(30... 78745 \n", "13 2901 Montopolis Drive\\nAustin, Texas 78741\\n(3... 78741 \n", "14 1000 Toyath Street\\nAustin, Texas 78703\\n(30.2... 78703 \n", "15 15 Waller Street\\nAustin, Texas 78702\\n(30.252... 78702 \n", "16 2508 Durwood St.\\nAustin, Texas 78704\\n(30.239... 78704 \n", "17 7201 Levander Loop, Building E\\nAustin, Texas ... 78702 \n", "18 1416 Montopolis Drive\\nAustin, Texas 78741\\n(3... 78741 \n", "19 211 Comal St.\\nAustin, Texas 78702\\n(30.259745... 78702 \n", "20 3518 FM 973\\nDel Valle, Texas 78617\\n(30.19879... 78617 \n", "21 2800 Webberville Road\\nAustin, Texas 78702\\n(3... 78702 \n", "22 15822 Foothill Farms Loop\\nPflugerville, Texas... 78660 \n", "23 7201 Levander Loop, Bulding C\\nAustin, Texas 7... 78702 \n", "24 8701 Research Blvd., Suite B\\nAustin, Texas 78... 78758 \n", "25 928 Blackson Avenue\\nAustin, Texas 78752\\n(30.... 78752 \n", "26 7500 Blessing Avenue\\nAustin, Texas 78752\\n(30... 78752 \n", "27 218 South Main Street\\nElgin, Texas 78621\\n(30... 78621 \n", "28 7201 Levander Loop, Building H\\nAustin, Texas ... 78702 \n", "29 2800 Webberville Road\\nAustin, Texas 78702\\n(3... 78702 \n", "30 211 Comal St\\nAustin, Texas 78702\\n(30.259718,... 78702 \n", "31 8656 Hwy. 71 W, Building A Ste B\\nAustin, Texa... 78735 \n", "\n", " Hours \\\n", "0 Monday 7:30am to 7pm, closed 12 noon to 1pm; T... \n", "1 Monday to Friday, 8am to 4:30pm \n", "2 Thursday 9am to 2:30pm, closed 12 noon to 12:30pm \n", "3 Monday and Tuesday 7:30 a.m. to 7 p.m., closed... \n", "4 Sunday - Saturday 7:00am to 7:00pm \n", "5 Monday and Tuesday 7:30am to 7:00pm, closed 12... \n", "6 Monday and Wednesday 7:45am to 11:30am; Tuesda... \n", "7 Monday - Thursday: 11 AM - 9 PM, Friday 11 AM ... \n", "8 Monday to Thursday 8am to 6pm; Friday 8am to 1... \n", "9 Monday and Tuesday 7:30am to 7:00pm, closed 12... \n", "10 NaN \n", "11 Monday to Thursday 8 a.m. to 6 p.m.; Friday 8 ... \n", "12 Monday and Tuesday 7:30am to 7:00pm, closed 12... \n", "13 Monday and Tuesday 8am to 7pm, closed 12 noon ... \n", "14 Monday to Friday, 8am - 4:30pm \n", "15 Monday to Friday 8am to 5pm \n", "16 Monday and Tuesday 7:30am to 7:00 p.m., closed... \n", "17 NaN \n", "18 Tuesday 8am to noon and 1pm to 5pm \n", "19 Monday to Thursday 8am to 6pm; closed 12noon t... \n", "20 Monday 8am to 7pm; closed 12 noon to 12:30pm; ... \n", "21 Monday to Friday 8am to 6pm; Fridays 8am to noon \n", "22 Monday and Tuesday 7:30am to 7:00pm, closed 12... \n", "23 NaN \n", "24 Monday, Wednesday, and Thursday 8am to 5pm, c... \n", "25 NaN \n", "26 Monday to Thursday 8 a.m. – 6 p.m.; Friday 8... \n", "27 Tuesdays 8:00am to 5:00pm, closed 12 noon to 1... \n", "28 NaN \n", "29 Monday and Tuesday 7:30am to 7:00pm, closed 12... \n", "30 Monday toThursday 8am to 6pm; Friday 8am to noon \n", "31 Monday 8am to 5pm, closed 12 noon to 12:30pm \n", "\n", " Website Phone Number \\\n", "0 NaN 512-972-4942 \n", "1 https://austintexas.gov/birthcertificates 512-972-4784 \n", "2 http://www.austintexas.gov/department/manor-wi... 512-972-4942 \n", "3 http://www.austintexas.gov/department/st-johns... 512-972-4942 \n", "4 NaN 512-972-5010 \n", "5 http://www.austintexas.gov/department/northwes... 512-972-4942 \n", "6 https://austintexas.gov/department/environment... 512-978-0300 \n", "7 NaN 12-978-2300 \n", "8 NaN 512-972-5790 \n", "9 http://www.austintexas.gov/department/dove-spr... 512-972-4942 \n", "10 http://www.austintexas.gov/online-form/first-w... 512-972-4100 \n", "11 http://www.austintexas.gov/department/south-au... 512-972-6840 \n", "12 http://www.austintexas.gov/department/far-sout... 512-972-4942 \n", "13 http://www.austintexas.gov/department/montopol... 512-972-4942 \n", "14 http://www.austintexas.gov/department/clarksvi... NaN \n", "15 http://www.austintexas.gov/department/rbj-heal... 512-972-5400 \n", "16 http://www.austintexas.gov/department/south-au... 512-972-4942 \n", "17 NaN 512-972-5000 \n", "18 http://www.austintexas.gov/department/montopol... 512-962-6650 \n", "19 http://www.austintexas.gov/department/east-aus... 512-972-4942 \n", "20 http://www.austintexas.gov/department/del-vall... 512-972-4942 \n", "21 http://www.austintexas.gov/department/rosewood... 512-972-6740 \n", "22 http://www.austintexas.gov/department/pflugerv... 512-972-4942 \n", "23 NaN 512-972-5000 \n", "24 http://www.austintexas.gov/department/moms-pla... 512-719-3010 \n", "25 NaN 512-978-9740 \n", "26 http://www.austintexas.gov/department/st-johns... 512-972-5139 \n", "27 http://www.austintexas.gov/department/elgin-wi... 512-972-4942 \n", "28 NaN NaN \n", "29 http://www.austintexas.gov/department/rosewood... 512-972-4942 \n", "30 http://www.austintexas.gov/department/east-aus... 512-972-6650 \n", "31 http://www.austintexas.gov/department/oak-hill... 512-972-4942 \n", "\n", " Other Phone Building ID Ownership Status \\\n", "0 NaN BAS Lease \n", "1 NaN NaN NaN \n", "2 NaN MAN NaN \n", "3 NaN SJC Lease \n", "4 NaN BDCB Own \n", "5 NaN NWW Lease \n", "6 NaN RLC Own \n", "7 NaN MRCC Own \n", "8 NaN BNC Own \n", "9 NaN DOV Lease \n", "10 NaN NaN Lease \n", "11 NaN SAN Own \n", "12 NaN FSH Own \n", "13 NaN MON Lease \n", "14 NaN CNC Own \n", "15 NaN RBJ Own \n", "16 NaN SAN Own \n", "17 NaN BDCE Own \n", "18 NaN MNC Own \n", "19 NaN EAN Own \n", "20 NaN DEL NaN \n", "21 NaN RZN Own \n", "22 NaN PFL NaN \n", "23 NaN BDCC Own \n", "24 1-800-514-6667 MOM Lease \n", "25 NaN AKB Own \n", "26 NaN SJC Lease \n", "27 NaN ELG NaN \n", "28 NaN BDCH Own \n", "29 NaN RZN Own \n", "30 NaN EAN Own \n", "31 NaN OAK NaN \n", "\n", " Owner \\\n", "0 The Marketplace at Bastrop \n", "1 NaN \n", "2 Travis County \n", "3 Austin Independent School Center \n", "4 City of Austin \n", "5 Van Family Real Estate Partnership, Ltd \n", "6 City of Austin \n", "7 City of Austin \n", "8 City of Austin \n", "9 LX-Northbluff Center, L.P. \n", "10 Najib Webbe \n", "11 City of Austin \n", "12 City of Austin \n", "13 Central \n", "14 City of Austin \n", "15 City of Austin \n", "16 City of Austin \n", "17 City of Austin \n", "18 City of Austin \n", "19 City of Austin \n", "20 Travis County \n", "21 City of Austin \n", "22 Travis County \n", "23 City of Austin \n", "24 Van Family Real Estate Partnership, Ltd \n", "25 City of Austin \n", "26 Austin Independent School District \n", "27 Travis County \n", "28 City of Austin \n", "29 City of Austin \n", "30 City of Austin \n", "31 Travis County \n", "\n", " Occupying Division \\\n", "0 Community Services \n", "1 NaN \n", "2 Community Services \n", "3 Community Services \n", "4 Epidemiology and Public Health Preparedness, O... \n", "5 Community Services \n", "6 Environmental Health Services \n", "7 Community Services \n", "8 Community Services \n", "9 Community Services \n", "10 Community Services \n", "11 Community Services \n", "12 Comunity Services, Disease Prevention and Heal... \n", "13 Community Services \n", "14 Disease Prevnetion and Health Promotion \n", "15 Administrative Support Services, Disease Prevn... \n", "16 Community Services \n", "17 Administrative Support Services, Health Equity... \n", "18 Community Services \n", "19 Community Services \n", "20 Community Services \n", "21 Community Services \n", "22 Community Services \n", "23 Community Services, Epidemiology, Public Healt... \n", "24 Community Services \n", "25 Community Services, Health Equity and Communit... \n", "26 Community Services \n", "27 Community Services \n", "28 Administrative Support Services, Community Ser... \n", "29 Community Services \n", "30 Community Services \n", "31 Community Services \n", "\n", " Occupancy Type Sq. Ft. Year Built \n", "0 Clinic 1400.0 NaN \n", "1 NaN NaN NaN \n", "2 Clinic 1700.0 NaN \n", "3 Clinic, Neighborhood Center 9559.0 2001.0 \n", "4 Offices 2190.0 NaN \n", "5 Clinic 4200.0 1993.0 \n", "6 Offices 2500.0 NaN \n", "7 Offices NaN NaN \n", "8 Neighborhood Center, Offices 347.0 1984.0 \n", "9 Clinic 2100.0 NaN \n", "10 Service Center 5315.0 NaN \n", "11 Clinic, Neighborhood Services 18651.0 1980.0 \n", "12 Clinic 4750.0 1982.0 \n", "13 Clinic 1993.0 2015.0 \n", "14 Clinic, Offices 3500.0 NaN \n", "15 Clinic, Offices 50809.0 1968.0 \n", "16 Clinic, Neighborhood Center 18651.0 1980.0 \n", "17 Offices 12403.0 NaN \n", "18 Neighborhood Center 2840.0 1976.0 \n", "19 Clinic, Neighborhood Center 4304.0 1981.0 \n", "20 Clinic 1000.0 NaN \n", "21 Clinic, Neighborhood Center 17128.0 1974.0 \n", "22 Clinic 2000.0 NaN \n", "23 Offices 7448.0 NaN \n", "24 Clinic 2080.0 1993.0 \n", "25 Clinic 4200.0 NaN \n", "26 Clinic, Neighborhood Center 9559.0 2001.0 \n", "27 Clinic 1500.0 NaN \n", "28 Offices 10016.0 NaN \n", "29 Clinic, Neighborhood Center 17128.0 1974.0 \n", "30 Clinic, Neighborhood Center 4304.0 1981.0 \n", "31 Clinic 1200.0 NaN " ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "df = pd.read_csv(path+'/Austin_Public_Health_Locations.csv')\n", "display(df)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Read the database into a raw text string. \n", "This will be our starting point." ] }, { "cell_type": "code", "execution_count": 54, "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Facility Name,Street Address,Zip Code,Hours,Website,Phone Number,Other Phone,Building ID,Ownership Status,Owner,Occupying Division,Occupancy Type,Sq. Ft. ,Year Built Bastrop WIC Clinic,\"443 Texas Highway 71Bastrop, Texas 78602(30.10646853400044, -97.33211573399967)\",78602,\"Monday 7:30am to 7pm, closed 12 noon to 1pm; Tuesday and Friday closed; Wednesday and Thursday 7:30 am to 4:30 pm, closed 12 noon to 12:30 pm (closed second Wednesday of each month); Second Saturday of each month 8am to 12 noon\",,512-972-4942,,BAS,Lease,The Marketplace at Bastrop,Community Services ,Clinic,1400,N/AVital Records,\"7201 Levander Loop, Building CAustin, Texas(30.252329, -97.690404)\",78702,\"Monday to Friday, 8am to 4:30pm\",https://austintexas.gov/birthcertificates,512-972-4784,,,,,,,,Manor WIC Clinic,\"600 West CarrieManor, Texas 78653(30.340164, -97.563744)\",78653,\"Thursday 9am to 2:30pm, closed 12 noon to 12:30pm\",http://www.austintexas.gov/department/manor-wic-clinic,512-972-4942,,MAN,N/A,Travis County ,Community Services ,Clinic,1700,N/ASt. Johns WIC Clinic,\"7500 Blessing AvenueAustin, Texas 78752(30.332635, -97.69335)\",78752,\"Monday and Tuesday 7:30 a.m. to 7 p.m., closed noon to 1 p.m.; Wednesday and Thursdays 7:30 a.m. to 4:30 p.m., closed noon to 12:30 p.m. (Closed second Wednesday of each month); Fridays 7:30am to noon; Second Saturday of each month 8 a.m. to noon\",http://www.austintexas.gov/department/st-johns-wic-clinic,512-972-4942,,SJC,Lease,Austin Independent School Center ,Community Services ,\"Clinic, Neighborhood Center \",9559,2001Betty Dunkerley Health Campus Building B,\"7201 Levander LoopAustin, Texas 78702(30.251305664000483, -97.69174879199966)\",78702,Sunday - Saturday 7:00am to 7:00pm,,512-972-5010,,BDCB,Own,City of Austin,\"Epidemiology and Public Health Preparedness, Office of the Director\",Offices ,2190,N/ANorthwest WIC Clinic,\"8701 Research Blvd, Suite AAustin, Texas 78758(30.365149, -97.716958)\",78758,\"Monday and Tuesday 7:30am to 7:00pm, closed 12 noon to 1:00pm; Wednesday and Thursday 7:30am to 7:00pm, closed 12 noon to 12:30pm (Closed second Wednesday of each month); Fridays 7:30am to 12 noon; Second Saturday of each month 8:00am to 12 noon\",http://www.austintexas.gov/department/northwest-wic-clinic,512-972-4942,,NWW,Lease,\"Van Family Real Estate Partnership, Ltd\",Community Services ,Clinic,4200,1993Rutherford Campus,\"1520 Rutherford Lane, Bldg 1Austin, Texas 78754(30.337078, -97.68114)\",78754,\"Monday and Wednesday 7:45am to 11:30am; Tuesday, Thursday, and Friday 7:45am to 4:30 pm\",https://austintexas.gov/department/environmental-health-services,512-978-0300,,RLC,Own,City of Austin,Environmental Health Services ,Offices ,2500,N/AMontopolis Recreation Community Center ,\"1200 Montopolis Dr.Austin, Texas 78741(30.232386, -97.699893)\",78741,\"Monday - Thursday: 11 AM - 9 PM, Friday 11 AM - 6 PM, Saturday 10 AM - 4 PM, Sunday: Closed \",,12-978-2300,,MRCC ,Own ,City of Austin ,Community Services ,Offices ,,N/ABlackland Neighborhood Center,\"2005 Salina StAustin, Texas 78722(30.280750365000472, -97.72245940699969)\",78722,Monday to Thursday 8am to 6pm; Friday 8am to 12noon,,512-972-5790,,BNC,Own,City of Austin,Community Services,\"Neighborhood Center, Offices \",347,1984Dove Springs WIC Center,\"6801 South IH-35, Suite I & JAustin, Texas 78744(30.187722, -97.770861)\",78744,\"Monday and Tuesday 7:30am to 7:00pm, closed 12 noon to 1:00pm; Wednesday and Thursday 7:30am to 4:30pm, closed 12 noon to 12:30pm; Closed second Wednesday of each month; Friday 7:30am to 12 noon; Second Saturday of each month 8:00am to 12 noon\",http://www.austintexas.gov/department/dove-springs-wic-center,512-972-4942,,DOV,Lease,\"LX-Northbluff Center, L.P.\",Community Services ,Clinic,2100,N/AFirst Workers Day Labor Center ,\"4916 N IH 35Austin, Texas 78751(30.308436, -97.711863)\",78751,,http://www.austintexas.gov/online-form/first-workers-day-labor-job-request,512-972-4100,,,Lease,Najib Webbe ,Community Services ,Service Center ,5315,N/ASouth Austin Neighborhood Center,\"2508 Durwood St.Austin, Texas 78704(30.239254, -97.760064)\",78704,Monday to Thursday 8 a.m. to 6 p.m.; Friday 8 a.m. to noon,http://www.austintexas.gov/department/south-austin-neighborhood-center,512-972-6840,,SAN ,Own,City of Austin,Community Services ,\"Clinic, Neighborhood Services \",18651,1980Far South WIC Clinic,\"405 W. Stassney LaneAustin, Texas 78745(30.20701, -97.779239)\",78745,\"Monday and Tuesday 7:30am to 7:00pm, closed 12 noon to 1:00pm; Wednesday and Thursday 7:30am to 4:30pm, closed 12 noon to 12:30pm (Closed second Wednesday of each month); Fridays 7:30am to 12 noon; Second Saturday of each month 8:00am to 12 noon\",http://www.austintexas.gov/department/far-south-wic-clinic,512-972-4942,,FSH,Own,City of Austin,\"Comunity Services, Disease Prevention and Health Promotion\",Clinic,4750,1982Montopolis WIC Clinic,\"2901 Montopolis DriveAustin, Texas 78741(30.214991, -97.708833)\",78741,\"Monday and Tuesday 8am to 7pm, closed 12 noon to 1:00pm; Wednesday and Thursday 8am to 4:30pm, closed 12 noon to 12:30pm; Closed second Wednesday of each month; Friday 8am to 12 noon; Second Saturday of each month 8:00am to 12 noon\",http://www.austintexas.gov/department/montopolis-wic-clinic,512-972-4942,,MON,Lease,Central ,Community Services,Clinic,1993,2015Clarksville Community Health Center,\"1000 Toyath StreetAustin, Texas 78703(30.28122053000044, -97.76330054699969)\",78703,\"Monday to Friday, 8am - 4:30pm\",http://www.austintexas.gov/department/clarksville-community-health-center,,,CNC,Own,City of Austin,Disease Prevnetion and Health Promotion,\"Clinic, Offices \",3500,N/ARBJ Health Center ,\"15 Waller StreetAustin, Texas 78702(30.25231, -97.733446)\",78702,Monday to Friday 8am to 5pm,http://www.austintexas.gov/department/rbj-health-center,512-972-5400,,RBJ,Own,City of Austin,\"Administrative Support Services, Disease Prevnetion and Health Promotion, Epidemiology, Public Health Preparedness\",\"Clinic, Offices \",50809,1968South Austin WIC Clinic,\"2508 Durwood St.Austin, Texas 78704(30.239252, -97.760073)\",78704,\"Monday and Tuesday 7:30am to 7:00 p.m., closed noon to 1:00 p.m.; Wednesday and Thursday 7:30am to 4:30 pm, closed noon to 12:30 p.m.; (Closed second Wednesday of each month); Friday 7:30am to noon; Second Saturday of each month 8:00am to noon\",http://www.austintexas.gov/department/south-austin-wic-clinic,512-972-4942,,SAN ,Own,City of Austin ,Community Services ,\"Clinic, Neighborhood Center \",18651,1980\"Betty Dunkerley Campus, Building E \",\"7201 Levander Loop, Building EAustin, Texas 78702(30.252944, -97.690225)\",78702,,,512-972-5000,,BDCE,Own ,City of Austin ,\"Administrative Support Services, Health Equity and Community Engagement, Office of the Director \",Offices ,12403,N/AMontopolis Neighborhood Center,\"1416 Montopolis DriveAustin, Texas 78741(30.229149, -97.701342)\",78741,Tuesday 8am to noon and 1pm to 5pm,http://www.austintexas.gov/department/montopolis-neighborhood-center,512-962-6650,,MNC,Own,City of Austin,Community Services ,Neighborhood Center ,2840,1976East Austin WIC Clinic,\"211 Comal St.Austin, Texas 78702(30.259745, -97.727356)\",78702,Monday to Thursday 8am to 6pm; closed 12noon to 1pm; Friday 8am to 12noon,http://www.austintexas.gov/department/east-austin-wic-clinic,512-972-4942,,EAN,Own,City of Austin,Community Services ,\"Clinic, Neighborhood Center \",4304,1981Del Valle WIC Clinic,\"3518 FM 973Del Valle, Texas 78617(30.198796, -97.642069)\",78617,\"Monday 8am to 7pm; closed 12 noon to 12:30pm; First and third Thursday of each month 8am to 4:30 pm, closed 12 noon to 12:30pm\",http://www.austintexas.gov/department/del-valle-wic-clinic,512-972-4942,,DEL,N/A,Travis County ,Community Services ,Clinic ,1000,N/ARosewood-Zaragosa Neighborhood Center,\"2800 Webberville RoadAustin, Texas 78702(30.265355, -97.710555)\",78702,Monday to Friday 8am to 6pm; Fridays 8am to noon,http://www.austintexas.gov/department/rosewood-zaragosa-neighborhood-center,512-972-6740,,RZN,Own,City of Austin,Community Services ,\"Clinic, Neighborhood Center \",17128,1974Pflugerville WIC Clinic,\"15822 Foothill Farms LoopPflugerville, Texas 78660(30.449001, -97.65186)\",78660,\"Monday and Tuesday 7:30am to 7:00pm, closed 12 noon to 1:00pm; Wednesday and Thursday 7:30am to 4:30pm, closed 12 noon to 12:30pm (Closed second Wednesday of each month); Friday 7:30am to 12 noon; Second Saturday of each month 8:00am to 12 noon\",http://www.austintexas.gov/department/pflugerville-wic-clinic,512-972-4942,,PFL,N/A,Travis County ,Community Services ,Clinic,2000,N/A\"Betty Dunkerley Health Campus, Building C\",\"7201 Levander Loop, Bulding CAustin, Texas 78702(30.251614, -97.690013)\",78702,,,512-972-5000,,BDCC,Own ,City of Austin ,\"Community Services, Epidemiology, Public Health Preparedness \",Offices,7448,N/AMom's Place - WIC Breastfeeding Resource Center,\"8701 Research Blvd., Suite BAustin, Texas 78758(30.364895, -97.71704)\",78758,\"Monday, Wednesday, and Thursday 8am to 5pm, closed 12:15pm to 12:45pm (Closed 2nd Wednesday of each month); Tuesday 8am to 6pm, closed 12:15pm to 12:45pm; Friday 8am to 2pm\",http://www.austintexas.gov/department/moms-place-wic-breastfeeding-resource-center,512-719-3010,1-800-514-6667,MOM,Lease,\"Van Family Real Estate Partnership, Ltd\",Community Services ,Clinic,2080,1993AK Black Health Center ,\"928 Blackson AvenueAustin, Texas 78752(30.333683, -97.698535)\",78752,,,512-978-9740,,AKB,Own,City of Austin ,\"Community Services, Health Equity and Community Engagement\",Clinic,4200,N/ASt. John Community Center,\"7500 Blessing AvenueAustin, Texas 78752(30.332632, -97.693348)\",78752,Monday to Thursday 8 a.m. – 6 p.m.; Friday 8 a.m. to noon,http://www.austintexas.gov/department/st-johns-community-center,512-972-5139,,SJC,Lease,Austin Independent School District ,Community Services ,\"Clinic, Neighborhood Center \",9559,2001Elgin WIC Clinic,\"218 South Main StreetElgin, Texas 78621(30.345313, -97.369808)\",78621,\"Tuesdays 8:00am to 5:00pm, closed 12 noon to 12:30pm; Fridays 8:00am to 12:00pm\",http://www.austintexas.gov/department/elgin-wic-clinic,512-972-4942,,ELG,N/A,Travis County ,Community Services ,Clinic,1500,N/A\"Betty Dunkerley Campus Building H, Administrative Services \",\"7201 Levander Loop, Building HAustin, Texas 78702(30.253738, -97.689104)\",78702,,,,,BDCH,Own ,City of Austin,\"Administrative Support Services, Community Services, Health Equity and Community Engagement \",Offices ,10016,N/ARosewood-Zaragosa WIC Clinic,\"2800 Webberville RoadAustin, Texas 78702(30.265487, -97.71038)\",78702,\"Monday and Tuesday 7:30am to 7:00pm, closed 12 noon to 1:00p.m.; Wednesday and Thursday 7:30am to 4:30 pm, closed 12:00 noon to 12:30pm (Closed second Wednesday of each month); Friday 7:30am to 12:00 noon; Second Saturday of each month 8:00am to 12:00 noon\",http://www.austintexas.gov/department/rosewood-zaragosa-wic-clinic,512-972-4942,,RZN,Own,City of Austin,Community Services ,\"Clinic, Neighborhood Center \",17128,1974East Austin Neighborhood Center,\"211 Comal StAustin, Texas 78702(30.259718, -97.727464)\",78702,Monday toThursday 8am to 6pm; Friday 8am to noon,http://www.austintexas.gov/department/east-austin-neighborhood-center,512-972-6650,,EAN,Own,City of Austin,Community Services ,\"Clinic, Neighborhood Center \",4304,1981Oak Hill WIC Clinic,\"8656 Hwy. 71 W, Building A Ste BAustin, Texas 78735(30.251475, -97.893723)\",78735,\"Monday 8am to 5pm, closed 12 noon to 12:30pm\",http://www.austintexas.gov/department/oak-hill-wic-clinic,512-972-4942,,OAK,N/A,Travis County ,Community Services ,Clinic,1200,N/A\n" ] } ], "source": [ "with open(path+'/Austin_Public_Health_Locations.csv', 'r') as file:\n", " data = file.read().replace('\\n', '')\n", "print(data)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 2. Extract the phone numbers" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### We first construct a regular expression to match the phone numbers and break them into tuples. This involved a bit of trial and error." ] }, { "cell_type": "code", "execution_count": 57, "metadata": {}, "outputs": [], "source": [ "re_extract_phone_number = re.compile(r\"(\\d\\d\\d)-(\\d+)-(\\d+)\")" ] }, { "cell_type": "code", "execution_count": 59, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "[('512', '972', '4942'),\n", " ('512', '972', '4784'),\n", " ('512', '972', '4942'),\n", " ('512', '972', '4942'),\n", " ('512', '972', '5010'),\n", " ('512', '972', '4942'),\n", " ('512', '978', '0300'),\n", " ('512', '972', '5790'),\n", " ('512', '972', '4942'),\n", " ('512', '972', '4100'),\n", " ('512', '972', '6840'),\n", " ('512', '972', '4942'),\n", " ('512', '972', '4942'),\n", " ('512', '972', '5400'),\n", " ('512', '972', '4942'),\n", " ('512', '972', '5000'),\n", " ('512', '962', '6650'),\n", " ('512', '972', '4942'),\n", " ('512', '972', '4942'),\n", " ('512', '972', '6740'),\n", " ('512', '972', '4942'),\n", " ('512', '972', '5000'),\n", " ('512', '719', '3010'),\n", " ('800', '514', '6667'),\n", " ('512', '978', '9740'),\n", " ('512', '972', '5139'),\n", " ('512', '972', '4942'),\n", " ('512', '972', '4942'),\n", " ('512', '972', '6650'),\n", " ('512', '972', '4942')]" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "phone_number_list = re_extract_phone_number.findall(data)\n", "display(phone_number_list)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## 3. Put the phone numbers in the desired format" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Next we join together the tuples, separated by spaces:" ] }, { "cell_type": "code", "execution_count": 52, "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['512 972 4942',\n", " '512 972 4784',\n", " '512 972 4942',\n", " '512 972 4942',\n", " '512 972 5010',\n", " '512 972 4942',\n", " '512 978 0300',\n", " '512 972 5790',\n", " '512 972 4942',\n", " '512 972 4100',\n", " '512 972 6840',\n", " '512 972 4942',\n", " '512 972 4942',\n", " '512 972 5400',\n", " '512 972 4942',\n", " '512 972 5000',\n", " '512 962 6650',\n", " '512 972 4942',\n", " '512 972 4942',\n", " '512 972 6740',\n", " '512 972 4942',\n", " '512 972 5000',\n", " '512 719 3010',\n", " '800 514 6667',\n", " '512 978 9740',\n", " '512 972 5139',\n", " '512 972 4942',\n", " '512 972 4942',\n", " '512 972 6650',\n", " '512 972 4942']" ] }, "execution_count": 52, "metadata": {}, "output_type": "execute_result" } ], "source": [ "[' '.join(tuple) for tuple in phone_number_list]" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "#### Voila! Finis." ] }, { "cell_type": "code", "execution_count": null, "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "fastai_v1", "language": "python", "name": "fastai_v1" }, "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.7.3" } }, "nbformat": 4, "nbformat_minor": 2 }