{ "cells": [ { "cell_type": "markdown", "metadata": {}, "source": [ "# Scraping the information " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "How?\n", "\n", "- init session (gives you the cookies, the link to call later)\n", "- init search with the right parameters\n", "- get post response" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## First request (using a session)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "After watching this video, I realized he uses a [Session](http://docs.python-requests.org/en/v1.0.4/user/advanced/). Let's try this." ] }, { "cell_type": "code", "execution_count": 1, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import requests" ] }, { "cell_type": "code", "execution_count": 2, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "{\n", " \"cookies\": {\n", " \"sessioncookie\": \"123456789\"\n", " }\n", "}\n", "\n" ] } ], "source": [ "s = requests.Session()\n", "\n", "s.get('http://httpbin.org/cookies/set/sessioncookie/123456789')\n", "r = s.get(\"http://httpbin.org/cookies\")\n", "\n", "print(r.text)\n", "# '{\"cookies\": {\"sessioncookie\": \"123456789\"}}'" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "What if we do this with ameli?" ] }, { "cell_type": "code", "execution_count": 144, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 144, "metadata": {}, "output_type": "execute_result" } ], "source": [ "s = requests.Session()\n", "\n", "r = s.get('http://ameli-direct.ameli.fr')\n", "\n", "r" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Getting the link for the second request" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Getting the interesting link:" ] }, { "cell_type": "code", "execution_count": 145, "metadata": { "collapsed": true }, "outputs": [], "source": [ "test_string = \"\"\"
\n", "
\n", "
\n", "\t

Je recherche :

\"\"\"" ] }, { "cell_type": "code", "execution_count": 146, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import re" ] }, { "cell_type": "code", "execution_count": 147, "metadata": { "collapsed": false }, "outputs": [], "source": [ "p = re.compile('')" ] }, { "cell_type": "code", "execution_count": 148, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "['/recherche-ceca2094e7dec344ca69beca17f092d2.html']" ] }, "execution_count": 148, "metadata": {}, "output_type": "execute_result" } ], "source": [ "p.findall(test_string)" ] }, { "cell_type": "code", "execution_count": 149, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "u'/recherche-f37e8ccd9299ffd0512f6451db3292f5.html'" ] }, "execution_count": 149, "metadata": {}, "output_type": "execute_result" } ], "source": [ "suburl = p.findall(r.text)[0]\n", "suburl" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Good, we have an entry point into the system: the url we need to find." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "It also looks like we have cookies!" ] }, { "cell_type": "code", "execution_count": 150, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "<[Cookie(version=0, name='AmeliDirectPersist', value='359719223.20480.0000', port=None, port_specified=False, domain='ameli-direct.ameli.fr', domain_specified=False, domain_initial_dot=False, path='/', path_specified=True, secure=False, expires=None, discard=True, comment=None, comment_url=None, rest={}, rfc2109=False), Cookie(version=0, name='TS01b76c1f', value='0139dce0d28a9787802f747bcf08b6311fb05ccb4900b3de48d0dd0cef0edb971ad476c5f5d562a2319762d297a76ee857a78f2b93d3e5edc3568d2fa9675da7728b624e5a', port=None, port_specified=False, domain='ameli-direct.ameli.fr', domain_specified=False, domain_initial_dot=False, path='/', path_specified=True, secure=False, expires=None, discard=True, comment=None, comment_url=None, rest={}, rfc2109=False), Cookie(version=0, name='infosoins', value='qbm8t56jclinm2kcdduqs51dc1', port=None, port_specified=False, domain='ameli-direct.ameli.fr', domain_specified=False, domain_initial_dot=False, path='/', path_specified=True, secure=False, expires=1445287024, discard=False, comment=None, comment_url=None, rest={}, rfc2109=False)]>" ] }, "execution_count": 150, "metadata": {}, "output_type": "execute_result" } ], "source": [ "r.cookies" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "## Making the second request " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now, which request do we have to complete to finish this? We primarily need the sort of payload we want to ask the site for:" ] }, { "cell_type": "code", "execution_count": 151, "metadata": { "collapsed": false }, "outputs": [], "source": [ "headers = {\"User-Agent\":\"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.71 Safari/537.36\"}\n", "\n", "payload = {\"type\":\"ps\",\n", " \"ps_profession\":\"ophtalmologiste\",\n", " \"ps_localisation\":\"75014\"}\n", "\n", "r = s.post(\"http://ameli-direct.ameli.fr\" + suburl, params=payload,\n", " headers=headers)" ] }, { "cell_type": "code", "execution_count": 152, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 152, "metadata": {}, "output_type": "execute_result" } ], "source": [ "r" ] }, { "cell_type": "code", "execution_count": 153, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "u'\\n\\n\\tAnnuaire sant\\xe9 d\\'ameli.fr : trouver un m\\xe9decin, un h\\xf4pital...\\n\\t\\n\\t\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n
\\n\\t
\\n\\t\"L\\'Assurance\\n\\t

\"Annuaire

\\n\\t\"Je\\n\\t
\\n\\t\\t
\\n\\t\\t\\tAcc\\xe9der \\xe0 mon compte\\n\\t\\t\\t\\t
\\n\\t\\t
\\n\\t\\t\\tOuvrir mon compte\\n\\t\\t
\\n\\t
\\n
\\t \\t
\\n \\t\\t
\\n \\t\\t\\t

Accueil > Professionnels de sant\\xe9 > R\\xe9sultats de la recherche

\\n \\t\\t
\\n \\t\\t\\n
\\n
\\n\\t
\\n\\t \\t
\\n \\n

26 r\\xe9sultats correspondent \\xe0 votre recherche

\\n
    \\n \\t
  • Profession : Ophtalmologiste
  • \\n
  • Lieu : 75014
  • \\n
\\n
Dans la liste ci-dessous, ne figurent que les professionnels de sant\\xe9 qui exercent une activit\\xe9 lib\\xe9rale et les centres de sant\\xe9.
\\n
\\n
\"Voir
\\t\\t
\\n\\t
\\n
\\n
\\n\\t \\t \\t
\\n \\t\\t
\\n \\t\\t\"Infos\"\\n \\t\\t

\"AffichezAffichez les professionnels de sant\\xe9 selon le type d\\u2019honoraires

\\n \\t\\t\\t\\n \\t\\t
\\n \\t
\\n \\t \\t \\t\\n \\t
\\n \\t\\t
\\n \\t\\t

Affichez les professionnels de sant\\xe9 indiquant leurs horaires

\\n \\t\\t\\n \\t\\t
\\n \\t
\\n \\t \\t \\t\\n \\t
\\n \\t\\t
\\n \\t\\t

Affichez les professionnels de sant\\xe9 acceptant la carte Vitale

\\n \\t\\t\\n \\t\\t
\\n \\t
\\n \\t \\t \\t\\n \\t\\n \\t \\t\\n \\t
\\n \\t\\t
\\n \\t\\t

Affichez les centres de sant\\xe9

\\n \\t\\t\\n \\t\\t
\\n \\t
\\n \\t \\t\\n \\t\\n
\\n
\\n\\t
\\n\\t
\\n\\t\\t
\\n\\t\\t\\t\\n\\t\\t\\t\\t\\n\\t\\t\\t\\t\\n\\t \\n \\n\\t\\t
\\n\\t\\t
\\n\\t
\\n\\t\\t Page sur 2\"Page\"\\t
\\n
\\n\\t\\t
\\n
\\n
1
Honoraires libres
01 43 35 31 48
29 RUE D ALESIA
75014 PARIS
2
Honoraires libres
CLINIQUE STE GENEVIEVE
29 RUE SARRETTE
75014 PARIS
3
Honoraires libres
01 45 65 04 24
12 RUE DE LA TOMBE ISSOIRE
75014 PARIS
4
Honoraires libres
95 AVENUE DU GAL LECLERC
75014 PARIS
5
Honoraires libres
01 43 22 42 33
228 BOULEVARD RASPAIL
75014 PARIS
6
Honoraires libres
01 45 41 73 63
22 RUE ERNEST CRESSON
75014 PARIS
7
Honoraires libres
SELARL CHASSIGNOL VAN WENT
79 AVENUE DU GENERAL LECLERC
75014 PARIS
8
Honoraires libres
01 43 35 41 03
10 RUE DAGUERRE
75014 PARIS
9
\"Cet
CTRE SANTE MEDICAL DENTAIRE TISSERAND
C A S VILLE DE PARIS
134 RUE D ALESIA
75014 PARIS
01 45 39 49 29
10
Honoraires libres
01 58 41 22 00
HOPITAL COCHIN
27 RUE DU FBG SAINT JACQUES
75014 PARIS
11
Honoraires libres
01 40 47 00 00
90 AVENUE DU MAINE
75014 PARIS
12
Honoraires libres
01 43 35 08 28
118 BOULEVARD MONTPARNASSE
75014 PARIS
13
Honoraires libres
01 43 27 10 69
SELARL CHASSIGNOL VAN WENT
79 AVENUE DU GENERAL LECLERC
75014 PARIS
14
Honoraires libres
01 43 20 62 55
29 BOULEVARD E.QUINET
75014 PARIS
15
Honoraires libres
01 40 44 65 30
150 RUE R LOSSERAND
75014 PARIS
16
Honoraires libres
SELARL DU DR MICHEL PUECH
7 RUE BOISSONADE
75014 PARIS
17
Honoraires libres
01 45 42 75 74
24 AVENUE VILLEMAIN
75014 PARIS
18
Honoraires libres
29 RUE SARRETTE.
75014 PARIS
19
Honoraires libres
244 BOULEVARD RASPAIL
75014 PARIS
20
Honoraires libres
01 43 35 43 33
3 RUE VICTOR CONSIDERANT
75014 PARIS
\\n
\\n
\\n \\n \\n
\\n
\\n
\\n\\t
\\n\\t\\t Page sur 2\"Page\"\\t
\\n
\\n
\\n\\t
\\n\\t
\\n
\\n
\\t
\\n \\t
\\n \\t\\t
L\\'utilisation du service offert sur ce site est soumise au respect des conditions d\\'utilisation. Toute reproduction int\\xe9grale ou partielle des contenus, donn\\xe9es et informations disponibles est illicite et peut donner lieu \\xe0 des sanctions.
\\n \\t
\\n\\t\\t\\t\\t

Les autres sites de l\\'Assurance Maladie

\\n\\t\\t\\t\\t
\"ameli.fr\"
Je m\\'informe sur mes droits et mes d\\xe9marches
\\n\\t\\t\\t\\t
\"ameli-sante.fr\"
Je m\\'informe sur ma sant\\xe9
\\n\\t\\t\\t\\t
\"ameli-sophia.fr\"
Le service d\\'accompagnement pour mieux vivre avec une maladie chronique
\\n\\t\\t\\t
\\n\\t\\t\\t
\\n \\t\\t\\n \\t
\\n
\\n\\n\\n\\n\\n\\n'" ] }, "execution_count": 153, "metadata": {}, "output_type": "execute_result" } ], "source": [ "r.text" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Good, the first part of our work is done!" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# The parsing " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's use beautiful soup to parse the document structure. There's a great documentation here: [http://www.crummy.com/software/BeautifulSoup/bs4/doc/](http://www.crummy.com/software/BeautifulSoup/bs4/doc/)." ] }, { "cell_type": "code", "execution_count": 154, "metadata": { "collapsed": false }, "outputs": [], "source": [ "import bs4" ] }, { "cell_type": "code", "execution_count": 155, "metadata": { "collapsed": true }, "outputs": [], "source": [ "from bs4 import BeautifulSoup\n", "soup = BeautifulSoup(r.text, 'html.parser')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "BS gives us an easy access to most things from the structure." ] }, { "cell_type": "code", "execution_count": 156, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "Annuaire santé d'ameli.fr : trouver un médecin, un hôpital..." ] }, "execution_count": 156, "metadata": {}, "output_type": "execute_result" } ], "source": [ "soup.title" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can find tags easily." ] }, { "cell_type": "code", "execution_count": 157, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "[LE QUOY,\n", " SELLAM,\n", " BINN DEUTSCHER,\n", " CHAMOUNI,\n", " CHARLOT,\n", " COMMEAU,\n", " VAN WENT,\n", " THAN TRONG,\n", " BREZIN,\n", " SULMAN,\n", " FELLER,\n", " CHASSIGNOL,\n", " MEYER,\n", " KRETZ,\n", " PUECH,\n", " WERTHEL,\n", " MAGNANI,\n", " GIRARD DECIS,\n", " KELLER]" ] }, "execution_count": 157, "metadata": {}, "output_type": "execute_result" } ], "source": [ "soup.findAll('strong')" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "All doctors can be found like this:" ] }, { "cell_type": "code", "execution_count": 158, "metadata": { "collapsed": false }, "outputs": [], "source": [ "doctors = soup.findAll('div', attrs={\"class\":\"item-professionnel\"})" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "A single doctor looks like this." ] }, { "cell_type": "code", "execution_count": 159, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "
1
Honoraires libres
01 43 35 31 48
29 RUE D ALESIA
75014 PARIS
" ] }, "execution_count": 159, "metadata": {}, "output_type": "execute_result" } ], "source": [ "doctors[0]" ] }, { "cell_type": "code", "execution_count": 160, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "20" ] }, "execution_count": 160, "metadata": {}, "output_type": "execute_result" } ], "source": [ "len(doctors)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's write a function that allows us to extract just the things we want." ] }, { "cell_type": "code", "execution_count": 161, "metadata": { "collapsed": false }, "outputs": [], "source": [ "block = doctors[0]" ] }, { "cell_type": "code", "execution_count": 162, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "
\n", "
\n", " \n", " 1\n", " \n", "
\n", "

\n", " \n", " \n", " LE QUOY\n", " \n", " OLIVIER\n", " \n", "

\n", "
\n", "
\n", "
\n", "
\n", "
\n", "
\n", "
\n", "
\n", "
\n", "
\n", "
\n", " Honoraires libres\n", "
\n", "
\n", "
\n", "
\n", " 01 43 35 31 48\n", "
\n", " \n", "
\n", "
\n", "
\n", " 29 RUE D ALESIA\n", "
\n", " 75014 PARIS\n", "
\n", "
\n", "
\n", "
\n", "
\n", "
\n", "
\n", "
\n", "\n" ] } ], "source": [ "print(block.prettify())" ] }, { "cell_type": "code", "execution_count": 163, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "u'LE QUOY OLIVIER'" ] }, "execution_count": 163, "metadata": {}, "output_type": "execute_result" } ], "source": [ "block.find('h2').text" ] }, { "cell_type": "code", "execution_count": 164, "metadata": { "collapsed": false }, "outputs": [], "source": [ "name = block.find('h2')" ] }, { "cell_type": "code", "execution_count": 165, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "[u'LE QUOY', u'OLIVIER']" ] }, "execution_count": 165, "metadata": {}, "output_type": "execute_result" } ], "source": [ "[text for text in name.stripped_strings]" ] }, { "cell_type": "code", "execution_count": 166, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "[u'29 RUE D ALESIA', u'75014 PARIS']" ] }, "execution_count": 166, "metadata": {}, "output_type": "execute_result" } ], "source": [ "adr = block.find(\"div\", attrs={'class':\"item left adresse\"})\n", "[text for text in adr.stripped_strings]" ] }, { "cell_type": "code", "execution_count": 167, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "u'29 RUE D ALESIA75014 PARIS'" ] }, "execution_count": 167, "metadata": {}, "output_type": "execute_result" } ], "source": [ "adr.get_text()" ] }, { "cell_type": "code", "execution_count": 168, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "u'29 RUE D ALESIA 75014 PARIS'" ] }, "execution_count": 168, "metadata": {}, "output_type": "execute_result" } ], "source": [ "adr.get_text(' ')" ] }, { "cell_type": "code", "execution_count": 169, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "u'01\\xa043\\xa035\\xa031\\xa048'" ] }, "execution_count": 169, "metadata": {}, "output_type": "execute_result" } ], "source": [ "block.find(\"div\", attrs={'class':\"item left tel\"}).text" ] }, { "cell_type": "code", "execution_count": 170, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "u'Honoraires libres'" ] }, "execution_count": 170, "metadata": {}, "output_type": "execute_result" } ], "source": [ "block.find(\"div\", attrs={'class':\"item right type_honoraires\"}).text" ] }, { "cell_type": "code", "execution_count": 171, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "u'Conventionn\\xe9 secteur 2'" ] }, "execution_count": 171, "metadata": {}, "output_type": "execute_result" } ], "source": [ "block.find(\"div\", attrs={'class':\"item right convention\"}).text" ] }, { "cell_type": "code", "execution_count": 172, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def extract_information(block):\n", " name = block.find('h2')\n", " address = block.find(\"div\", attrs={'class':\"item left adresse\"})\n", " phone = block.find(\"div\", attrs={'class':\"item left tel\"})\n", " prices = block.find(\"div\", attrs={'class':\"item right type_honoraires\"})\n", " convention = block.find(\"div\", attrs={'class':\"item right convention\"})\n", " return [item.get_text(' ') for item in [name, address, phone, prices, convention] if item is not None]" ] }, { "cell_type": "code", "execution_count": 173, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "[u'LE QUOY OLIVIER', u'29 RUE D ALESIA 75014 PARIS', u'01\\xa043\\xa035\\xa031\\xa048', u'Honoraires libres', u'Conventionn\\xe9 secteur 2']\n", "[u'SELLAM MICKAEL', u'CLINIQUE STE GENEVIEVE 29 RUE SARRETTE 75014 PARIS', u'Honoraires libres', u'Conventionn\\xe9 secteur 2']\n", "[u'BINN DEUTSCHER SYLVIE', u'12 RUE DE LA TOMBE ISSOIRE 75014 PARIS', u'01\\xa045\\xa065\\xa004\\xa024', u'Honoraires libres', u'Conventionn\\xe9 secteur 2']\n", "[u'CHAMOUNI HUBERT', u'95 AVENUE DU GAL LECLERC 75014 PARIS', u'Honoraires libres', u'Conventionn\\xe9 secteur 2']\n", "[u'CHARLOT JEAN CLAUDE', u'228 BOULEVARD RASPAIL 75014 PARIS', u'01\\xa043\\xa022\\xa042\\xa033', u'Honoraires libres', u'Conventionn\\xe9 secteur 2']\n", "[u'COMMEAU DOMINIQUE', u'22 RUE ERNEST CRESSON 75014 PARIS', u'01\\xa045\\xa041\\xa073\\xa063', u'Honoraires libres', u'Conventionn\\xe9 secteur 2']\n", "[u'VAN WENT CHARLES', u'SELARL CHASSIGNOL VAN WENT 79 AVENUE DU GENERAL LECLERC 75014 PARIS', u'Honoraires libres', u'Conventionn\\xe9 secteur 2']\n", "[u'THAN TRONG THONG', u'10 RUE DAGUERRE 75014 PARIS', u'01\\xa043\\xa035\\xa041\\xa003', u'Honoraires libres', u'Conventionn\\xe9 secteur 2']\n", "[u'CTRE SANTE MEDICAL DENTAIRE TISSERAND', u'CTRE SANTE MEDICAL DENTAIRE TISSERAND C A S VILLE DE PARIS 134 RUE D ALESIA 75014 PARIS']\n", "[u'BREZIN ANTOINE', u'HOPITAL COCHIN 27 RUE DU FBG SAINT JACQUES 75014 PARIS', u'01\\xa058\\xa041\\xa022\\xa000', u'Honoraires libres', u'Conventionn\\xe9 secteur 2']\n", "[u'SULMAN JEAN JACQUES', u'90 AVENUE DU MAINE 75014 PARIS', u'01\\xa040\\xa047\\xa000\\xa000', u'Honoraires libres', u'Conventionn\\xe9 secteur 2']\n", "[u'FELLER MICHEL', u'118 BOULEVARD MONTPARNASSE 75014 PARIS', u'01\\xa043\\xa035\\xa008\\xa028', u'Honoraires libres', u'Conventionn\\xe9 secteur 2']\n", "[u'CHASSIGNOL ALEXIS', u'SELARL CHASSIGNOL VAN WENT 79 AVENUE DU GENERAL LECLERC 75014 PARIS', u'01\\xa043\\xa027\\xa010\\xa069', u'Honoraires libres', u'Conventionn\\xe9 secteur 2']\n", "[u'MEYER MARIE CLAUDE', u'29 BOULEVARD E.QUINET 75014 PARIS', u'01\\xa043\\xa020\\xa062\\xa055', u'Honoraires libres', u'Conventionn\\xe9 secteur 2']\n", "[u'KRETZ GILLES', u'150 RUE R LOSSERAND 75014 PARIS', u'01\\xa040\\xa044\\xa065\\xa030', u'Honoraires libres', u'Conventionn\\xe9 secteur 2']\n", "[u'PUECH MICHEL', u'SELARL DU DR MICHEL PUECH 7 RUE BOISSONADE 75014 PARIS', u'Honoraires libres', u'Conventionn\\xe9 secteur 2']\n", "[u'WERTHEL ANDREE LUCE', u'24 AVENUE VILLEMAIN 75014 PARIS', u'01\\xa045\\xa042\\xa075\\xa074', u'Honoraires libres', u'Conventionn\\xe9 secteur 2']\n", "[u'MAGNANI MATTEO', u'29 RUE SARRETTE. 75014 PARIS', u'Honoraires libres', u'Conventionn\\xe9 secteur 2']\n", "[u'GIRARD DECIS ANAIS', u'244 BOULEVARD RASPAIL 75014 PARIS', u'Honoraires libres', u'Conventionn\\xe9 secteur 2']\n", "[u'KELLER PIERRE', u'3 RUE VICTOR CONSIDERANT 75014 PARIS', u'01\\xa043\\xa035\\xa043\\xa033', u'Honoraires libres', u'Conventionn\\xe9 secteur 2']\n" ] } ], "source": [ "for doc in doctors:\n", " print(extract_information(doc))" ] }, { "cell_type": "code", "execution_count": 174, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import pandas as pd" ] }, { "cell_type": "code", "execution_count": 175, "metadata": { "collapsed": false }, "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", "
01234
0 LE QUOY OLIVIER 29 RUE D ALESIA 75014 PARIS 01 43 35 31 48 Honoraires libres Conventionné secteur 2
1 SELLAM MICKAEL CLINIQUE STE GENEVIEVE 29 RUE SARRETTE 75014 P... Honoraires libres Conventionné secteur 2 None
2 BINN DEUTSCHER SYLVIE 12 RUE DE LA TOMBE ISSOIRE 75014 PARIS 01 45 65 04 24 Honoraires libres Conventionné secteur 2
3 CHAMOUNI HUBERT 95 AVENUE DU GAL LECLERC 75014 PARIS Honoraires libres Conventionné secteur 2 None
4 CHARLOT JEAN CLAUDE 228 BOULEVARD RASPAIL 75014 PARIS 01 43 22 42 33 Honoraires libres Conventionné secteur 2
5 COMMEAU DOMINIQUE 22 RUE ERNEST CRESSON 75014 PARIS 01 45 41 73 63 Honoraires libres Conventionné secteur 2
6 VAN WENT CHARLES SELARL CHASSIGNOL VAN WENT 79 AVENUE DU GENERA... Honoraires libres Conventionné secteur 2 None
7 THAN TRONG THONG 10 RUE DAGUERRE 75014 PARIS 01 43 35 41 03 Honoraires libres Conventionné secteur 2
8 CTRE SANTE MEDICAL DENTAIRE TISSERAND CTRE SANTE MEDICAL DENTAIRE TISSERAND C A S VI... None None None
9 BREZIN ANTOINE HOPITAL COCHIN 27 RUE DU FBG SAINT JACQUES 750... 01 58 41 22 00 Honoraires libres Conventionné secteur 2
10 SULMAN JEAN JACQUES 90 AVENUE DU MAINE 75014 PARIS 01 40 47 00 00 Honoraires libres Conventionné secteur 2
11 FELLER MICHEL 118 BOULEVARD MONTPARNASSE 75014 PARIS 01 43 35 08 28 Honoraires libres Conventionné secteur 2
12 CHASSIGNOL ALEXIS SELARL CHASSIGNOL VAN WENT 79 AVENUE DU GENERA... 01 43 27 10 69 Honoraires libres Conventionné secteur 2
13 MEYER MARIE CLAUDE 29 BOULEVARD E.QUINET 75014 PARIS 01 43 20 62 55 Honoraires libres Conventionné secteur 2
14 KRETZ GILLES 150 RUE R LOSSERAND 75014 PARIS 01 40 44 65 30 Honoraires libres Conventionné secteur 2
15 PUECH MICHEL SELARL DU DR MICHEL PUECH 7 RUE BOISSONADE 750... Honoraires libres Conventionné secteur 2 None
16 WERTHEL ANDREE LUCE 24 AVENUE VILLEMAIN 75014 PARIS 01 45 42 75 74 Honoraires libres Conventionné secteur 2
17 MAGNANI MATTEO 29 RUE SARRETTE. 75014 PARIS Honoraires libres Conventionné secteur 2 None
18 GIRARD DECIS ANAIS 244 BOULEVARD RASPAIL 75014 PARIS Honoraires libres Conventionné secteur 2 None
19 KELLER PIERRE 3 RUE VICTOR CONSIDERANT 75014 PARIS 01 43 35 43 33 Honoraires libres Conventionné secteur 2
\n", "
" ], "text/plain": [ " 0 \\\n", "0 LE QUOY OLIVIER \n", "1 SELLAM MICKAEL \n", "2 BINN DEUTSCHER SYLVIE \n", "3 CHAMOUNI HUBERT \n", "4 CHARLOT JEAN CLAUDE \n", "5 COMMEAU DOMINIQUE \n", "6 VAN WENT CHARLES \n", "7 THAN TRONG THONG \n", "8 CTRE SANTE MEDICAL DENTAIRE TISSERAND \n", "9 BREZIN ANTOINE \n", "10 SULMAN JEAN JACQUES \n", "11 FELLER MICHEL \n", "12 CHASSIGNOL ALEXIS \n", "13 MEYER MARIE CLAUDE \n", "14 KRETZ GILLES \n", "15 PUECH MICHEL \n", "16 WERTHEL ANDREE LUCE \n", "17 MAGNANI MATTEO \n", "18 GIRARD DECIS ANAIS \n", "19 KELLER PIERRE \n", "\n", " 1 2 \\\n", "0 29 RUE D ALESIA 75014 PARIS 01 43 35 31 48 \n", "1 CLINIQUE STE GENEVIEVE 29 RUE SARRETTE 75014 P... Honoraires libres \n", "2 12 RUE DE LA TOMBE ISSOIRE 75014 PARIS 01 45 65 04 24 \n", "3 95 AVENUE DU GAL LECLERC 75014 PARIS Honoraires libres \n", "4 228 BOULEVARD RASPAIL 75014 PARIS 01 43 22 42 33 \n", "5 22 RUE ERNEST CRESSON 75014 PARIS 01 45 41 73 63 \n", "6 SELARL CHASSIGNOL VAN WENT 79 AVENUE DU GENERA... Honoraires libres \n", "7 10 RUE DAGUERRE 75014 PARIS 01 43 35 41 03 \n", "8 CTRE SANTE MEDICAL DENTAIRE TISSERAND C A S VI... None \n", "9 HOPITAL COCHIN 27 RUE DU FBG SAINT JACQUES 750... 01 58 41 22 00 \n", "10 90 AVENUE DU MAINE 75014 PARIS 01 40 47 00 00 \n", "11 118 BOULEVARD MONTPARNASSE 75014 PARIS 01 43 35 08 28 \n", "12 SELARL CHASSIGNOL VAN WENT 79 AVENUE DU GENERA... 01 43 27 10 69 \n", "13 29 BOULEVARD E.QUINET 75014 PARIS 01 43 20 62 55 \n", "14 150 RUE R LOSSERAND 75014 PARIS 01 40 44 65 30 \n", "15 SELARL DU DR MICHEL PUECH 7 RUE BOISSONADE 750... Honoraires libres \n", "16 24 AVENUE VILLEMAIN 75014 PARIS 01 45 42 75 74 \n", "17 29 RUE SARRETTE. 75014 PARIS Honoraires libres \n", "18 244 BOULEVARD RASPAIL 75014 PARIS Honoraires libres \n", "19 3 RUE VICTOR CONSIDERANT 75014 PARIS 01 43 35 43 33 \n", "\n", " 3 4 \n", "0 Honoraires libres Conventionné secteur 2 \n", "1 Conventionné secteur 2 None \n", "2 Honoraires libres Conventionné secteur 2 \n", "3 Conventionné secteur 2 None \n", "4 Honoraires libres Conventionné secteur 2 \n", "5 Honoraires libres Conventionné secteur 2 \n", "6 Conventionné secteur 2 None \n", "7 Honoraires libres Conventionné secteur 2 \n", "8 None None \n", "9 Honoraires libres Conventionné secteur 2 \n", "10 Honoraires libres Conventionné secteur 2 \n", "11 Honoraires libres Conventionné secteur 2 \n", "12 Honoraires libres Conventionné secteur 2 \n", "13 Honoraires libres Conventionné secteur 2 \n", "14 Honoraires libres Conventionné secteur 2 \n", "15 Conventionné secteur 2 None \n", "16 Honoraires libres Conventionné secteur 2 \n", "17 Conventionné secteur 2 None \n", "18 Conventionné secteur 2 None \n", "19 Honoraires libres Conventionné secteur 2 " ] }, "execution_count": 175, "metadata": {}, "output_type": "execute_result" } ], "source": [ "pd.DataFrame([extract_information(doc) for doc in doctors])" ] }, { "cell_type": "markdown", "metadata": { "collapsed": true }, "source": [ "# Extending the search: going for the 20 results per pages " ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "If there are more than 20 results for a given query, you only get them 20 by 20. The idea is to read this information from the first source and then perform the additional queries needed." ] }, { "cell_type": "code", "execution_count": 176, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "{'content-encoding': 'gzip', 'transfer-encoding': 'chunked', 'expires': 'Mon, 19 Oct 2015 13:37:12 GMT', 'vary': 'Accept-Encoding', 'connection': 'close', 'pragma': 'no-cache', 'cache-control': 'no-store, no-cache, must-revalidate, post-check=0, pre-check=0', 'date': 'Mon, 19 Oct 2015 12:37:13 GMT', 'x-powered-by': 'Zend Framework 1.12.3', 'content-type': 'text/html; charset=UTF-8'}" ] }, "execution_count": 176, "metadata": {}, "output_type": "execute_result" } ], "source": [ "r.headers" ] }, { "cell_type": "code", "execution_count": 177, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "{'Connection': 'keep-alive', 'Cookie': 'TS01b76c1f=0139dce0d28a9787802f747bcf08b6311fb05ccb4900b3de48d0dd0cef0edb971ad476c5f5d562a2319762d297a76ee857a78f2b93d3e5edc3568d2fa9675da7728b624e5a; infosoins=qbm8t56jclinm2kcdduqs51dc1; AmeliDirectPersist=359719223.20480.0000', 'Accept-Encoding': 'gzip, deflate', 'Accept': '*/*', 'User-Agent': 'Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.71 Safari/537.36'}" ] }, "execution_count": 177, "metadata": {}, "output_type": "execute_result" } ], "source": [ "r.request.headers" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "The URL containing the next doctors can be found in the request url." ] }, { "cell_type": "code", "execution_count": 178, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "u'http://ameli-direct.ameli.fr/professionnels-de-sante/recherche-1/liste-resultats-page-1-par_page-20-tri-aleatoire-f37e8ccd9299ffd0512f6451db3292f5.html'" ] }, "execution_count": 178, "metadata": {}, "output_type": "execute_result" } ], "source": [ "r.url" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "We can also find the number of doctors found in the body of the previous request." ] }, { "cell_type": "code", "execution_count": 179, "metadata": { "collapsed": true }, "outputs": [], "source": [ "soup = BeautifulSoup(r.text)" ] }, { "cell_type": "code", "execution_count": 180, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "[

\"Annuaire

,\n", "

26 résultats correspondent à votre recherche

]" ] }, "execution_count": 180, "metadata": {}, "output_type": "execute_result" } ], "source": [ "tags = soup.find_all(name=\"h1\")\n", "tags" ] }, { "cell_type": "code", "execution_count": 181, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "26 résultats correspondent à votre recherche\n" ] } ], "source": [ "for tag in tags:\n", " if tag.string is not None:\n", " print(tag.string)" ] }, { "cell_type": "code", "execution_count": 182, "metadata": { "collapsed": false }, "outputs": [], "source": [ "p = re.compile(u\"(\\d+) résultats correspondent à votre recherche\")" ] }, { "cell_type": "code", "execution_count": 183, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "26\n" ] } ], "source": [ "for tag in tags:\n", " if tag.string is not None:\n", " print(p.findall(tag.string)[0])" ] }, { "cell_type": "code", "execution_count": 236, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def extract_number_of_doctors(soup):\n", " p = re.compile(u\"(\\d+) résultats correspondent à votre recherche\")\n", " tags = soup.find_all(name=\"h1\")\n", " for tag in tags:\n", " if tag.string is not None:\n", " return int(p.findall(tag.string)[0])\n", " return 0" ] }, { "cell_type": "code", "execution_count": 237, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "26" ] }, "execution_count": 237, "metadata": {}, "output_type": "execute_result" } ], "source": [ "extract_number_of_doctors(soup)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Now, we can automate the process of fetching pages. Here, we need to go until 26 doctors, so the number of pages to retrieve is 2." ] }, { "cell_type": "code", "execution_count": 189, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import math" ] }, { "cell_type": "code", "execution_count": 192, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "1\n", "2\n" ] } ], "source": [ "for pagenumber in range(1, int(math.ceil(extract_number_of_doctors(soup) / 20.)) + 1):\n", " print pagenumber" ] }, { "cell_type": "code", "execution_count": 193, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "u'http://ameli-direct.ameli.fr/professionnels-de-sante/recherche-1/liste-resultats-page-1-par_page-20-tri-aleatoire-f37e8ccd9299ffd0512f6451db3292f5.html'" ] }, "execution_count": 193, "metadata": {}, "output_type": "execute_result" } ], "source": [ "r.url" ] }, { "cell_type": "code", "execution_count": 194, "metadata": { "collapsed": false }, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "http://ameli-direct.ameli.fr/professionnels-de-sante/recherche-1/liste-resultats-page-1-par_page-20-tri-aleatoire-f37e8ccd9299ffd0512f6451db3292f5.html\n", "http://ameli-direct.ameli.fr/professionnels-de-sante/recherche-1/liste-resultats-page-2-par_page-20-tri-aleatoire-f37e8ccd9299ffd0512f6451db3292f5.html\n" ] } ], "source": [ "for pagenumber in range(1, int(math.ceil(extract_number_of_doctors(soup) / 20.)) + 1):\n", " print(r.url.replace(\"liste-resultats-page-1-par_page-20\", \"liste-resultats-page-{}-par_page-20\").format(pagenumber))" ] }, { "cell_type": "code", "execution_count": 195, "metadata": { "collapsed": true }, "outputs": [], "source": [ "r2 = s.post(r.url.replace(\"liste-resultats-page-1-par_page-20\", \"liste-resultats-page-{}-par_page-20\").format(2))" ] }, { "cell_type": "code", "execution_count": 196, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 196, "metadata": {}, "output_type": "execute_result" } ], "source": [ "r2" ] }, { "cell_type": "code", "execution_count": 197, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "u'\\n\\n\\tAnnuaire sant\\xe9 d\\'ameli.fr : trouver un m\\xe9decin, un h\\xf4pital...\\n\\t\\n\\t\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n
\\n\\t
\\n\\t\"L\\'Assurance\\n\\t

\"Annuaire

\\n\\t\"Je\\n\\t
\\n\\t\\t
\\n\\t\\t\\tAcc\\xe9der \\xe0 mon compte\\n\\t\\t\\t\\t
\\n\\t\\t
\\n\\t\\t\\tOuvrir mon compte\\n\\t\\t
\\n\\t
\\n
\\t \\t
\\n \\t\\t
\\n \\t\\t\\t

Accueil > Professionnels de sant\\xe9 > R\\xe9sultats de la recherche

\\n \\t\\t
\\n \\t\\t\\n
\\n
\\n\\t
\\n\\t \\t
\\n \\n

26 r\\xe9sultats correspondent \\xe0 votre recherche

\\n
    \\n \\t
  • Profession : Ophtalmologiste
  • \\n
  • Lieu : 75014
  • \\n
\\n
Dans la liste ci-dessous, ne figurent que les professionnels de sant\\xe9 qui exercent une activit\\xe9 lib\\xe9rale et les centres de sant\\xe9.
\\n
\\n
\"Voir
\\t\\t
\\n\\t
\\n
\\n
\\n\\t \\t \\t
\\n \\t\\t
\\n \\t\\t\"Infos\"\\n \\t\\t

\"AffichezAffichez les professionnels de sant\\xe9 selon le type d\\u2019honoraires

\\n \\t\\t\\t\\n \\t\\t
\\n \\t
\\n \\t \\t \\t\\n \\t
\\n \\t\\t
\\n \\t\\t

Affichez les professionnels de sant\\xe9 indiquant leurs horaires

\\n \\t\\t\\n \\t\\t
\\n \\t
\\n \\t \\t \\t\\n \\t
\\n \\t\\t
\\n \\t\\t

Affichez les professionnels de sant\\xe9 acceptant la carte Vitale

\\n \\t\\t\\n \\t\\t
\\n \\t
\\n \\t \\t \\t\\n \\t\\n \\t \\t\\n \\t
\\n \\t\\t
\\n \\t\\t

Affichez les centres de sant\\xe9

\\n \\t\\t\\n \\t\\t
\\n \\t
\\n \\t \\t\\n \\t\\n
\\n
\\n\\t
\\n\\t
\\n\\t\\t
\\n\\t\\t\\t
\\n\\t\\t\\t\\t\\n\\t\\t\\t\\t\\n\\t \\n
\\n\\t\\t
\\n\\t\\t
\\n\\t
\\n\\t\\t\"Aller\"Page Page sur 2\\t
\\n
\\n\\t\\t
\\n
\\n
1
Honoraires sans d\\xe9passement
01 45 45 32 12
87 RUE DE GERGOVIE
75014 PARIS
2
Honoraires libres
01 43 20 91 75
142 BOULEVARD DU MONTPARNASSE
75014 PARIS
3
Honoraires libres
01 43 35 41 03
10 RUE DAGUERRE
75014 PARIS
4
Honoraires libres
01 56 53 58 58
SARL SARRETTE
29 RUE SARRETTE
75014 PARIS
5
Honoraires libres
01 43 20 91 75
142 BOULEVARD DU MONTPARNASSE
75014 PARIS
6
Honoraires libres
01 58 41 21 91
HOPITAL COCHIN
27 RUE DU FBG SAINT JACQUES
75014 PARIS
\\n
\\n
\\n \\n \\n
\\n
\\n
\\n\\t
\\n\\t\\t\"Aller\"Page Page sur 2\\t
\\n
\\n
\\n\\t
\\n\\t
\\n
\\n
\\t
\\n \\t
\\n \\t\\t
L\\'utilisation du service offert sur ce site est soumise au respect des conditions d\\'utilisation. Toute reproduction int\\xe9grale ou partielle des contenus, donn\\xe9es et informations disponibles est illicite et peut donner lieu \\xe0 des sanctions.
\\n \\t
\\n\\t\\t\\t\\t

Les autres sites de l\\'Assurance Maladie

\\n\\t\\t\\t\\t
\"ameli.fr\"
Je m\\'informe sur mes droits et mes d\\xe9marches
\\n\\t\\t\\t\\t
\"ameli-sante.fr\"
Je m\\'informe sur ma sant\\xe9
\\n\\t\\t\\t\\t
\"ameli-sophia.fr\"
Le service d\\'accompagnement pour mieux vivre avec une maladie chronique
\\n\\t\\t\\t
\\n\\t\\t\\t
\\n \\t\\t\\n \\t
\\n
\\n\\n\\n\\n\\n\\n'" ] }, "execution_count": 197, "metadata": {}, "output_type": "execute_result" } ], "source": [ "r2.text" ] }, { "cell_type": "code", "execution_count": 198, "metadata": { "collapsed": false }, "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", "
NomAdresseTéléphoneHonorairesConvention
0 DRYLEWICZ JOEL 87 RUE DE GERGOVIE 75014 PARIS 01 45 45 32 12 Honoraires sans dépassement Conventionné secteur 1
1 BOUMENDIL JULIEN 142 BOULEVARD DU MONTPARNASSE 75014 PARIS 01 43 20 91 75 Honoraires libres Conventionné secteur 2
2 SARFATI ADRIEN 10 RUE DAGUERRE 75014 PARIS 01 43 35 41 03 Honoraires libres Conventionné secteur 2
3 PIETRINI DOMINIQUE SARL SARRETTE 29 RUE SARRETTE 75014 PARIS 01 56 53 58 58 Honoraires libres Conventionné secteur 2
4 TAZARTES MICHEL 142 BOULEVARD DU MONTPARNASSE 75014 PARIS 01 43 20 91 75 Honoraires libres Conventionné secteur 2
5 MONNET DOMINIQUE HOPITAL COCHIN 27 RUE DU FBG SAINT JACQUES 750... 01 58 41 21 91 Honoraires libres Conventionné secteur 2
\n", "
" ], "text/plain": [ " Nom Adresse \\\n", "0 DRYLEWICZ JOEL 87 RUE DE GERGOVIE 75014 PARIS \n", "1 BOUMENDIL JULIEN 142 BOULEVARD DU MONTPARNASSE 75014 PARIS \n", "2 SARFATI ADRIEN 10 RUE DAGUERRE 75014 PARIS \n", "3 PIETRINI DOMINIQUE SARL SARRETTE 29 RUE SARRETTE 75014 PARIS \n", "4 TAZARTES MICHEL 142 BOULEVARD DU MONTPARNASSE 75014 PARIS \n", "5 MONNET DOMINIQUE HOPITAL COCHIN 27 RUE DU FBG SAINT JACQUES 750... \n", "\n", " Téléphone Honoraires Convention \n", "0 01 45 45 32 12 Honoraires sans dépassement Conventionné secteur 1 \n", "1 01 43 20 91 75 Honoraires libres Conventionné secteur 2 \n", "2 01 43 35 41 03 Honoraires libres Conventionné secteur 2 \n", "3 01 56 53 58 58 Honoraires libres Conventionné secteur 2 \n", "4 01 43 20 91 75 Honoraires libres Conventionné secteur 2 \n", "5 01 58 41 21 91 Honoraires libres Conventionné secteur 2 " ] }, "execution_count": 198, "metadata": {}, "output_type": "execute_result" } ], "source": [ "soup = BeautifulSoup(r2.text, 'html.parser')\n", "doctors = soup.findAll('div', attrs={\"class\":\"item-professionnel\"})\n", "pd.DataFrame([extract_information(doc) for doc in doctors], columns=['Nom', u'Adresse', u\"Téléphone\", u\"Honoraires\", \"Convention\"])" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "In the second frame, we only got 6 doctors, which is what we expected. This seems to work." ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Putting it all together " ] }, { "cell_type": "code", "execution_count": 244, "metadata": { "collapsed": true }, "outputs": [], "source": [ "def make_query(specialty, location):\n", " \"\"\"queries Ameli for a given specialty of doctors in a given location\n", " returns a pandas dataframe or None if no doctors have been found\"\"\"\n", " \n", " # create new session and open the connection to get cookies\n", " s = requests.Session()\n", " r = s.get('http://ameli-direct.ameli.fr')\n", " \n", " # extract the page towards which we make our first request\n", " p = re.compile('
')\n", " suburl = p.findall(r.text)[0]\n", " \n", " # make the request\n", " headers = {\"User-Agent\":\"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/46.0.2490.71 Safari/537.36\"}\n", " payload = {\"type\":\"ps\",\n", " \"ps_profession\":specialty,\n", " \"ps_localisation\":location}\n", " r = s.post(\"http://ameli-direct.ameli.fr\" + suburl, params=payload,\n", " headers=headers)\n", " \n", " # extract information\n", " soup = BeautifulSoup(r.text, 'html.parser')\n", " number_of_doctors = extract_number_of_doctors(soup)\n", " if number_of_doctors == 0:\n", " return None\n", " \n", " # loop over needed pages\n", " dfs = []\n", " for pagenumber in range(1, int(math.ceil(number_of_doctors / 20.)) + 1):\n", " r2 = s.post(r.url.replace(\"liste-resultats-page-1-par_page-20\", \n", " \"liste-resultats-page-{}-par_page-20\").format(pagenumber))\n", " soup = BeautifulSoup(r2.text)\n", " doctors = soup.findAll('div', attrs={\"class\":\"item-professionnel\"})\n", " dfs.append(pd.DataFrame([extract_information(doc) for doc in doctors], \n", " columns=['Nom', u'Adresse', u\"Téléphone\", u\"Honoraires\", \"Convention\"]))\n", " \n", " return pd.concat(dfs, ignore_index=True)\n", " " ] }, { "cell_type": "code", "execution_count": 239, "metadata": { "collapsed": false }, "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", "
NomAdresseTéléphoneHonorairesConvention
0 KOHANE BERNARD 31 AVENUE VERDIER 92120 MONTROUGE 01 46 56 90 90 Honoraires libres Conventionné secteur 2
1 CENTRE DE SANTE MUNICIPAL CENTRE DE SANTE MUNICIPAL 5 RUE AMAURY DUVAL 9... None None None
2 KHAYAT NADINE 10 RUE V. HUGO 92120 MONTROUGE 01 82 00 15 16 Honoraires sans dépassement Conventionné secteur 1
3 DEBBASCH JEAN MARC 31 AVENUE VERDIER 92120 MONTROUGE 01 46 56 90 90 Honoraires libres Conventionné secteur 2
\n", "
" ], "text/plain": [ " Nom \\\n", "0 KOHANE BERNARD \n", "1 CENTRE DE SANTE MUNICIPAL \n", "2 KHAYAT NADINE \n", "3 DEBBASCH JEAN MARC \n", "\n", " Adresse Téléphone \\\n", "0 31 AVENUE VERDIER 92120 MONTROUGE 01 46 56 90 90 \n", "1 CENTRE DE SANTE MUNICIPAL 5 RUE AMAURY DUVAL 9... None \n", "2 10 RUE V. HUGO 92120 MONTROUGE 01 82 00 15 16 \n", "3 31 AVENUE VERDIER 92120 MONTROUGE 01 46 56 90 90 \n", "\n", " Honoraires Convention \n", "0 Honoraires libres Conventionné secteur 2 \n", "1 None None \n", "2 Honoraires sans dépassement Conventionné secteur 1 \n", "3 Honoraires libres Conventionné secteur 2 " ] }, "execution_count": 239, "metadata": {}, "output_type": "execute_result" } ], "source": [ "make_query(\"ophtalmologiste\", \"92120\")" ] }, { "cell_type": "code", "execution_count": 240, "metadata": { "collapsed": false }, "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", "
NomAdresseTéléphoneHonorairesConvention
0 BIANCHI FREDERIQUE L ATHENA 1 AVENUE DE VERDUN 06800 CAGNES SUR MER 04 93 20 87 08 Honoraires libres Conventionné secteur 2
1 COTTA CLAIRE CABINET DU DR CARL LOUBOUTIN LE ST JACQUES 7 B... 04 93 20 59 40 Honoraires libres Conventionné secteur 2
2 COTTA CLAIRE SCM ABEL LE ST JACQUES 7 BOULEVARD MARECHAL JU... Honoraires libres Conventionné secteur 2 None
3 LECCIA BOUCKAERT LAETITIA CONSULTATION ST JEAN BT A 53 AVENUE DES ALPES ... Honoraires libres Conventionné secteur 2 None
4 LOUBOUTIN CARL 7 BOULEVARD MARECHAL JUIN 06800 CAGNES SUR MER Honoraires libres Conventionné secteur 2 None
5 FERRARA LUCIE LE SPLENDID 41 BOULEVARD MARECHAL JUIN 06800 C... 04 93 20 19 44 Honoraires avec dépassements maîtrisés (contra... Conventionné secteur 2 avec contrat d'accès au...
6 CHEPTEA IRINA SA POLYCLINIQUE ST JEAN POLYCLINIQUE ST JEAN 9... 04 92 13 53 13 Honoraires libres Conventionné secteur 2
7 CHEPTEA IRINA SELARL CABINET DU DR CHEPTEA VILLA EMILIE - EN... 04 93 20 66 70 Honoraires libres Conventionné secteur 2
8 BIJAOUI SAMUEL POLYCLINIQUE SAINT JEAN 92 AVENUE DU DR MAURIC... 04 92 13 53 13 Honoraires libres Conventionné secteur 2
9 BIJAOUI SAMUEL ENTREE B VILLA EMILIE 48 BOULEVARD MARECHAL JU... 04 93 20 66 70 Honoraires libres Conventionné secteur 2
10 GOZAL SULTAN DOMINIQUE LE SAINT JACQUES 7 BOULEVARD MARECHAL JUIN 068... Honoraires libres Conventionné secteur 2 None
\n", "
" ], "text/plain": [ " Nom \\\n", "0 BIANCHI FREDERIQUE \n", "1 COTTA CLAIRE \n", "2 COTTA CLAIRE \n", "3 LECCIA BOUCKAERT LAETITIA \n", "4 LOUBOUTIN CARL \n", "5 FERRARA LUCIE \n", "6 CHEPTEA IRINA \n", "7 CHEPTEA IRINA \n", "8 BIJAOUI SAMUEL \n", "9 BIJAOUI SAMUEL \n", "10 GOZAL SULTAN DOMINIQUE \n", "\n", " Adresse Téléphone \\\n", "0 L ATHENA 1 AVENUE DE VERDUN 06800 CAGNES SUR MER 04 93 20 87 08 \n", "1 CABINET DU DR CARL LOUBOUTIN LE ST JACQUES 7 B... 04 93 20 59 40 \n", "2 SCM ABEL LE ST JACQUES 7 BOULEVARD MARECHAL JU... Honoraires libres \n", "3 CONSULTATION ST JEAN BT A 53 AVENUE DES ALPES ... Honoraires libres \n", "4 7 BOULEVARD MARECHAL JUIN 06800 CAGNES SUR MER Honoraires libres \n", "5 LE SPLENDID 41 BOULEVARD MARECHAL JUIN 06800 C... 04 93 20 19 44 \n", "6 SA POLYCLINIQUE ST JEAN POLYCLINIQUE ST JEAN 9... 04 92 13 53 13 \n", "7 SELARL CABINET DU DR CHEPTEA VILLA EMILIE - EN... 04 93 20 66 70 \n", "8 POLYCLINIQUE SAINT JEAN 92 AVENUE DU DR MAURIC... 04 92 13 53 13 \n", "9 ENTREE B VILLA EMILIE 48 BOULEVARD MARECHAL JU... 04 93 20 66 70 \n", "10 LE SAINT JACQUES 7 BOULEVARD MARECHAL JUIN 068... Honoraires libres \n", "\n", " Honoraires \\\n", "0 Honoraires libres \n", "1 Honoraires libres \n", "2 Conventionné secteur 2 \n", "3 Conventionné secteur 2 \n", "4 Conventionné secteur 2 \n", "5 Honoraires avec dépassements maîtrisés (contra... \n", "6 Honoraires libres \n", "7 Honoraires libres \n", "8 Honoraires libres \n", "9 Honoraires libres \n", "10 Conventionné secteur 2 \n", "\n", " Convention \n", "0 Conventionné secteur 2 \n", "1 Conventionné secteur 2 \n", "2 None \n", "3 None \n", "4 None \n", "5 Conventionné secteur 2 avec contrat d'accès au... \n", "6 Conventionné secteur 2 \n", "7 Conventionné secteur 2 \n", "8 Conventionné secteur 2 \n", "9 Conventionné secteur 2 \n", "10 None " ] }, "execution_count": 240, "metadata": {}, "output_type": "execute_result" } ], "source": [ "make_query(\"ophtalmologiste\", \"06800\")" ] }, { "cell_type": "code", "execution_count": 241, "metadata": { "collapsed": false }, "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", "
NomAdresseTéléphoneHonorairesConvention
0 CHARLOT JEAN CLAUDE 228 BOULEVARD RASPAIL 75014 PARIS 01 43 22 42 33 Honoraires libres Conventionné secteur 2
1 COMMEAU DOMINIQUE 22 RUE ERNEST CRESSON 75014 PARIS 01 45 41 73 63 Honoraires libres Conventionné secteur 2
2 CHAMOUNI HUBERT 95 AVENUE DU GAL LECLERC 75014 PARIS Honoraires libres Conventionné secteur 2 None
3 VAN WENT CHARLES SELARL CHASSIGNOL VAN WENT 79 AVENUE DU GENERA... Honoraires libres Conventionné secteur 2 None
4 LE QUOY OLIVIER 29 RUE D ALESIA 75014 PARIS 01 43 35 31 48 Honoraires libres Conventionné secteur 2
5 SELLAM MICKAEL CLINIQUE STE GENEVIEVE 29 RUE SARRETTE 75014 P... Honoraires libres Conventionné secteur 2 None
6 BINN DEUTSCHER SYLVIE 12 RUE DE LA TOMBE ISSOIRE 75014 PARIS 01 45 65 04 24 Honoraires libres Conventionné secteur 2
7 FELLER MICHEL 118 BOULEVARD MONTPARNASSE 75014 PARIS 01 43 35 08 28 Honoraires libres Conventionné secteur 2
8 BREZIN ANTOINE HOPITAL COCHIN 27 RUE DU FBG SAINT JACQUES 750... 01 58 41 22 00 Honoraires libres Conventionné secteur 2
9 SULMAN JEAN JACQUES 90 AVENUE DU MAINE 75014 PARIS 01 40 47 00 00 Honoraires libres Conventionné secteur 2
10 CHASSIGNOL ALEXIS SELARL CHASSIGNOL VAN WENT 79 AVENUE DU GENERA... 01 43 27 10 69 Honoraires libres Conventionné secteur 2
11 CTRE SANTE MEDICAL DENTAIRE TISSERAND CTRE SANTE MEDICAL DENTAIRE TISSERAND C A S VI... None None None
12 THAN TRONG THONG 10 RUE DAGUERRE 75014 PARIS 01 43 35 41 03 Honoraires libres Conventionné secteur 2
13 MAGNANI MATTEO 29 RUE SARRETTE. 75014 PARIS Honoraires libres Conventionné secteur 2 None
14 WERTHEL ANDREE LUCE 24 AVENUE VILLEMAIN 75014 PARIS 01 45 42 75 74 Honoraires libres Conventionné secteur 2
15 DRYLEWICZ JOEL 87 RUE DE GERGOVIE 75014 PARIS 01 45 45 32 12 Honoraires sans dépassement Conventionné secteur 1
16 BOUMENDIL JULIEN 142 BOULEVARD DU MONTPARNASSE 75014 PARIS 01 43 20 91 75 Honoraires libres Conventionné secteur 2
17 SARFATI ADRIEN 10 RUE DAGUERRE 75014 PARIS 01 43 35 41 03 Honoraires libres Conventionné secteur 2
18 GIRARD DECIS ANAIS 244 BOULEVARD RASPAIL 75014 PARIS Honoraires libres Conventionné secteur 2 None
19 KELLER PIERRE 3 RUE VICTOR CONSIDERANT 75014 PARIS 01 43 35 43 33 Honoraires libres Conventionné secteur 2
20 KRETZ GILLES 150 RUE R LOSSERAND 75014 PARIS 01 40 44 65 30 Honoraires libres Conventionné secteur 2
21 MEYER MARIE CLAUDE 29 BOULEVARD E.QUINET 75014 PARIS 01 43 20 62 55 Honoraires libres Conventionné secteur 2
22 PUECH MICHEL SELARL DU DR MICHEL PUECH 7 RUE BOISSONADE 750... Honoraires libres Conventionné secteur 2 None
23 TAZARTES MICHEL 142 BOULEVARD DU MONTPARNASSE 75014 PARIS 01 43 20 91 75 Honoraires libres Conventionné secteur 2
24 MONNET DOMINIQUE HOPITAL COCHIN 27 RUE DU FBG SAINT JACQUES 750... 01 58 41 21 91 Honoraires libres Conventionné secteur 2
25 PIETRINI DOMINIQUE SARL SARRETTE 29 RUE SARRETTE 75014 PARIS 01 56 53 58 58 Honoraires libres Conventionné secteur 2
\n", "
" ], "text/plain": [ " Nom \\\n", "0 CHARLOT JEAN CLAUDE \n", "1 COMMEAU DOMINIQUE \n", "2 CHAMOUNI HUBERT \n", "3 VAN WENT CHARLES \n", "4 LE QUOY OLIVIER \n", "5 SELLAM MICKAEL \n", "6 BINN DEUTSCHER SYLVIE \n", "7 FELLER MICHEL \n", "8 BREZIN ANTOINE \n", "9 SULMAN JEAN JACQUES \n", "10 CHASSIGNOL ALEXIS \n", "11 CTRE SANTE MEDICAL DENTAIRE TISSERAND \n", "12 THAN TRONG THONG \n", "13 MAGNANI MATTEO \n", "14 WERTHEL ANDREE LUCE \n", "15 DRYLEWICZ JOEL \n", "16 BOUMENDIL JULIEN \n", "17 SARFATI ADRIEN \n", "18 GIRARD DECIS ANAIS \n", "19 KELLER PIERRE \n", "20 KRETZ GILLES \n", "21 MEYER MARIE CLAUDE \n", "22 PUECH MICHEL \n", "23 TAZARTES MICHEL \n", "24 MONNET DOMINIQUE \n", "25 PIETRINI DOMINIQUE \n", "\n", " Adresse Téléphone \\\n", "0 228 BOULEVARD RASPAIL 75014 PARIS 01 43 22 42 33 \n", "1 22 RUE ERNEST CRESSON 75014 PARIS 01 45 41 73 63 \n", "2 95 AVENUE DU GAL LECLERC 75014 PARIS Honoraires libres \n", "3 SELARL CHASSIGNOL VAN WENT 79 AVENUE DU GENERA... Honoraires libres \n", "4 29 RUE D ALESIA 75014 PARIS 01 43 35 31 48 \n", "5 CLINIQUE STE GENEVIEVE 29 RUE SARRETTE 75014 P... Honoraires libres \n", "6 12 RUE DE LA TOMBE ISSOIRE 75014 PARIS 01 45 65 04 24 \n", "7 118 BOULEVARD MONTPARNASSE 75014 PARIS 01 43 35 08 28 \n", "8 HOPITAL COCHIN 27 RUE DU FBG SAINT JACQUES 750... 01 58 41 22 00 \n", "9 90 AVENUE DU MAINE 75014 PARIS 01 40 47 00 00 \n", "10 SELARL CHASSIGNOL VAN WENT 79 AVENUE DU GENERA... 01 43 27 10 69 \n", "11 CTRE SANTE MEDICAL DENTAIRE TISSERAND C A S VI... None \n", "12 10 RUE DAGUERRE 75014 PARIS 01 43 35 41 03 \n", "13 29 RUE SARRETTE. 75014 PARIS Honoraires libres \n", "14 24 AVENUE VILLEMAIN 75014 PARIS 01 45 42 75 74 \n", "15 87 RUE DE GERGOVIE 75014 PARIS 01 45 45 32 12 \n", "16 142 BOULEVARD DU MONTPARNASSE 75014 PARIS 01 43 20 91 75 \n", "17 10 RUE DAGUERRE 75014 PARIS 01 43 35 41 03 \n", "18 244 BOULEVARD RASPAIL 75014 PARIS Honoraires libres \n", "19 3 RUE VICTOR CONSIDERANT 75014 PARIS 01 43 35 43 33 \n", "20 150 RUE R LOSSERAND 75014 PARIS 01 40 44 65 30 \n", "21 29 BOULEVARD E.QUINET 75014 PARIS 01 43 20 62 55 \n", "22 SELARL DU DR MICHEL PUECH 7 RUE BOISSONADE 750... Honoraires libres \n", "23 142 BOULEVARD DU MONTPARNASSE 75014 PARIS 01 43 20 91 75 \n", "24 HOPITAL COCHIN 27 RUE DU FBG SAINT JACQUES 750... 01 58 41 21 91 \n", "25 SARL SARRETTE 29 RUE SARRETTE 75014 PARIS 01 56 53 58 58 \n", "\n", " Honoraires Convention \n", "0 Honoraires libres Conventionné secteur 2 \n", "1 Honoraires libres Conventionné secteur 2 \n", "2 Conventionné secteur 2 None \n", "3 Conventionné secteur 2 None \n", "4 Honoraires libres Conventionné secteur 2 \n", "5 Conventionné secteur 2 None \n", "6 Honoraires libres Conventionné secteur 2 \n", "7 Honoraires libres Conventionné secteur 2 \n", "8 Honoraires libres Conventionné secteur 2 \n", "9 Honoraires libres Conventionné secteur 2 \n", "10 Honoraires libres Conventionné secteur 2 \n", "11 None None \n", "12 Honoraires libres Conventionné secteur 2 \n", "13 Conventionné secteur 2 None \n", "14 Honoraires libres Conventionné secteur 2 \n", "15 Honoraires sans dépassement Conventionné secteur 1 \n", "16 Honoraires libres Conventionné secteur 2 \n", "17 Honoraires libres Conventionné secteur 2 \n", "18 Conventionné secteur 2 None \n", "19 Honoraires libres Conventionné secteur 2 \n", "20 Honoraires libres Conventionné secteur 2 \n", "21 Honoraires libres Conventionné secteur 2 \n", "22 Conventionné secteur 2 None \n", "23 Honoraires libres Conventionné secteur 2 \n", "24 Honoraires libres Conventionné secteur 2 \n", "25 Honoraires libres Conventionné secteur 2 " ] }, "execution_count": 241, "metadata": {}, "output_type": "execute_result" } ], "source": [ "make_query(\"ophtalmologiste\", \"75014\")" ] }, { "cell_type": "code", "execution_count": 242, "metadata": { "collapsed": false }, "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", "
NomAdresseTéléphoneHonorairesConvention
0 MALBREL PIERRE HENRI 50 AVENUE LINNE 59100 ROUBAIX 03 20 75 82 43 Honoraires avec dépassements maîtrisés (contra... Conventionné secteur 1 avec contrat d'accès au...
1 GEVART FREDERIC SELARL DIDIER MOUTON 72 RUE DU COQ FRANCAIS 59... 03 20 70 59 29 Honoraires libres Conventionné secteur 2
2 GEVART FREDERIC CABINET DU DR OLIVIER LAFFINEUR 72 RUE DU COQ ... Honoraires libres Conventionné secteur 2 None
3 GEVART FREDERIC CABINET DU DR CHRISTIAN DOUCET 72 RUE DU COQ F... Honoraires libres Conventionné secteur 2 None
4 GEVART FREDERIC CABINE DU DR CELINE KARKOUTLY PARC DES 7 LIEUE... Honoraires libres Conventionné secteur 2 None
5 KARKOUTLY REZVOY CELINE CABINET DU DR CELINE KARKOUTLY PARC DES 7 LIEU... 03 20 70 59 29 Honoraires libres Conventionné secteur 2
6 LAFFINEUR OLIVIER CABINET DU DR OLIVIER LAFFINEUR 72 RUE DU COQ ... 03 20 70 59 29 Honoraires sans dépassement Conventionné secteur 1
7 MOUTON DIDIER SELARL DIDIER MOUTON 72 RUE DU COQ FRANCAIS 59... 03 20 70 59 29 Honoraires libres Conventionné secteur 2
8 CAB MEDICAL OPHTALMOLOGIQUE MUTUALISTE CAB MEDICAL OPHTALMOLOGIQUE MUTUALISTE 30 BVD ... None None None
9 DOUCET CHRISTIAN CABINET DU DR CHRISTIAN DOUCET 72 RUE DU COQ F... 03 20 70 59 29 Honoraires libres Conventionné secteur 2
10 LENTINI FERDINANDO CABINETDU DR FERDINANDO LENTINI ENTREE A 19 RU... 03 20 94 80 59 Honoraires avec dépassements maîtrisés (contra... Conventionné secteur 2 avec contrat d'accès au...
\n", "
" ], "text/plain": [ " Nom \\\n", "0 MALBREL PIERRE HENRI \n", "1 GEVART FREDERIC \n", "2 GEVART FREDERIC \n", "3 GEVART FREDERIC \n", "4 GEVART FREDERIC \n", "5 KARKOUTLY REZVOY CELINE \n", "6 LAFFINEUR OLIVIER \n", "7 MOUTON DIDIER \n", "8 CAB MEDICAL OPHTALMOLOGIQUE MUTUALISTE \n", "9 DOUCET CHRISTIAN \n", "10 LENTINI FERDINANDO \n", "\n", " Adresse Téléphone \\\n", "0 50 AVENUE LINNE 59100 ROUBAIX 03 20 75 82 43 \n", "1 SELARL DIDIER MOUTON 72 RUE DU COQ FRANCAIS 59... 03 20 70 59 29 \n", "2 CABINET DU DR OLIVIER LAFFINEUR 72 RUE DU COQ ... Honoraires libres \n", "3 CABINET DU DR CHRISTIAN DOUCET 72 RUE DU COQ F... Honoraires libres \n", "4 CABINE DU DR CELINE KARKOUTLY PARC DES 7 LIEUE... Honoraires libres \n", "5 CABINET DU DR CELINE KARKOUTLY PARC DES 7 LIEU... 03 20 70 59 29 \n", "6 CABINET DU DR OLIVIER LAFFINEUR 72 RUE DU COQ ... 03 20 70 59 29 \n", "7 SELARL DIDIER MOUTON 72 RUE DU COQ FRANCAIS 59... 03 20 70 59 29 \n", "8 CAB MEDICAL OPHTALMOLOGIQUE MUTUALISTE 30 BVD ... None \n", "9 CABINET DU DR CHRISTIAN DOUCET 72 RUE DU COQ F... 03 20 70 59 29 \n", "10 CABINETDU DR FERDINANDO LENTINI ENTREE A 19 RU... 03 20 94 80 59 \n", "\n", " Honoraires \\\n", "0 Honoraires avec dépassements maîtrisés (contra... \n", "1 Honoraires libres \n", "2 Conventionné secteur 2 \n", "3 Conventionné secteur 2 \n", "4 Conventionné secteur 2 \n", "5 Honoraires libres \n", "6 Honoraires sans dépassement \n", "7 Honoraires libres \n", "8 None \n", "9 Honoraires libres \n", "10 Honoraires avec dépassements maîtrisés (contra... \n", "\n", " Convention \n", "0 Conventionné secteur 1 avec contrat d'accès au... \n", "1 Conventionné secteur 2 \n", "2 None \n", "3 None \n", "4 None \n", "5 Conventionné secteur 2 \n", "6 Conventionné secteur 1 \n", "7 Conventionné secteur 2 \n", "8 None \n", "9 Conventionné secteur 2 \n", "10 Conventionné secteur 2 avec contrat d'accès au... " ] }, "execution_count": 242, "metadata": {}, "output_type": "execute_result" } ], "source": [ "make_query(\"ophtalmologiste\", \"59100\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Little study: where are Paris ophtalmologists located? " ] }, { "cell_type": "code", "execution_count": 208, "metadata": { "collapsed": true }, "outputs": [], "source": [ "ophtalmologists = {}\n", "for arrondissement in range(1, 21):\n", " arr_string = '75' + format(arrondissement, '03') \n", " ophtalmologists[arr_string] = make_query(\"ophtalmologiste\", arr_string)" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "Let's now make some plots!" ] }, { "cell_type": "code", "execution_count": 216, "metadata": { "collapsed": true }, "outputs": [], "source": [ "import numpy as np\n", "import matplotlib.pyplot as plt\n", "%matplotlib inline" ] }, { "cell_type": "code", "execution_count": 212, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "12" ] }, "execution_count": 212, "metadata": {}, "output_type": "execute_result" } ], "source": [ "ophtalmologists['75001'].shape[0]" ] }, { "cell_type": "code", "execution_count": 220, "metadata": { "collapsed": true }, "outputs": [], "source": [ "n = [ophtalmologists['75' + format(arrondissement, '03')].shape[0] for arrondissement in range(1, 21)]\n", "xticks = ['75' + format(arrondissement, '03') for arrondissement in range(1, 21)]" ] }, { "cell_type": "code", "execution_count": 214, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "[12, 7, 5, 11, 25, 33, 39, 40, 22, 6, 23, 37, 22, 26, 48, 53, 33, 11, 23, 11]" ] }, "execution_count": 214, "metadata": {}, "output_type": "execute_result" } ], "source": [ "n" ] }, { "cell_type": "code", "execution_count": 221, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "['75001',\n", " '75002',\n", " '75003',\n", " '75004',\n", " '75005',\n", " '75006',\n", " '75007',\n", " '75008',\n", " '75009',\n", " '75010',\n", " '75011',\n", " '75012',\n", " '75013',\n", " '75014',\n", " '75015',\n", " '75016',\n", " '75017',\n", " '75018',\n", " '75019',\n", " '75020']" ] }, "execution_count": 221, "metadata": {}, "output_type": "execute_result" } ], "source": [ "xticks" ] }, { "cell_type": "code", "execution_count": 226, "metadata": { "collapsed": false }, "outputs": [ { "data": { "text/plain": [ "" ] }, "execution_count": 226, "metadata": {}, "output_type": "execute_result" }, { "data": { "image/png": "iVBORw0KGgoAAAANSUhEUgAAAWwAAAEfCAYAAABlKfzWAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3Xm4HGWZ9/Hvj4TFYQsRTcIWHCSIuIEO4jYeFBUXEBdw\nGBdQZ9R3XBGXoNc7HnUUccYFRL2cQSAgA+KGwqtCRI6gCIiGfRcCYckJgRAWQVHu94/n6aTSp885\n1cvpU9X5fa6rr9NdXXXXXVVP3V39VFUfRQRmZlZ9G0x3AmZmVo4LtplZTbhgm5nVhAu2mVlNuGCb\nmdWEC7aZWU0MdMGWtFTSS6dp3nMknS/pfkn/2ePYI5Le2cN4U7KeJA1LOrkHcV4k6bpe5DTBPHqS\naxUV24ukN0s6e7pz6gdJR0j6n0HKY2YvglRY5Md0eBewIiK2mILY4y6XpB2Bm4GZEfFYt/G61JOY\nEXEB8JTJxpM0DOwUEW/tZDYdTFMXa7ZvRJwCnDK96XSvTDuPiCO7iH8icDDwl/z4PfD+iLi+3Vjd\n5NFsoI+we0VSJx9s84Fre51LGzSN826oQg5lTUuukma0GOb9sryp2m4BHBURmwPbASuAE9sN0mr7\ndqPvDSN//T5c0uWS7pN0mqSN83uHSrqgafzHJP19fn6ipG9I+qmkByRdIGmupKMlrZJ0raRnNc1y\nT0lXS7pX0vGNeeV4r5F0WZ72N5Ke3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K4bdJPnAP83IpZGxFdIZ137kUcvlmNQYlQhhyrFaJiu\nttmLGFXIoSoxqpDDWJ1cWtLug3X/Xc/l5K6YxuuSMW4HPgwcDixtilH2f8V1lUePlmMgYlQhh6rE\nqELb9DYdzHXR/OjXVSJPkPRhQKR/2VNU9t/tHAdsnsc/AXgCsELptubL+pRHL5ZjUGJUIYeqxKhC\n2+xFjCrkUJUYVchhjH4V7F406FXADyNiWXFgRNwFvK1PefRiOQYlRhVyqEqMKrTNXsSoQg5ViVGF\nHMbq5LC83QfwQWD7LmOsJvUBXUD6n2hP6HcePVqOgYhRhRyqEqMKbdPbdDDXxZiYvQw2QeK9aNBL\nSCdJX0666Pxu0j+0PIQW/7x0KvLo0XIMRIwq5FCVGFVom96mg7kuxsTsNkDJxHvRoJc0vd6IdEH6\nacDKfuTRq+UYhBhVyKEqMarQNr1NB3NdjInZyURtz6RHDXqC9zbtRx5TsRx1jVGFHKoSowpt09t0\nMNfFmJidTNT2THrToHeZ7jymYsesa4wq5FCVGFVom96mg7kumh/9+j3sXSLi+imf0RTn0YvlGJQY\nVcihSjG6VYXlqEIOVYlRhRxaxuxHwTYzs+7169Z0MzPrkgu2mVlNuGCbmdWEC7aZWU24YJuZ1cT/\nB5z0VWRpXbcQAAAAAElFTkSuQmCC\n", "text/plain": [ "" ] }, "metadata": {}, "output_type": "display_data" } ], "source": [ "plt.bar(np.arange(len(n)), n)\n", "plt.xticks(np.arange(len(n)) + 0.5, xticks, rotation=90)\n", "plt.title(\"number of ophtalmologists by arrondissement in Paris\")" ] }, { "cell_type": "markdown", "metadata": {}, "source": [ "# Extracting ophtalmologists for given cities " ] }, { "cell_type": "code", "execution_count": 228, "metadata": { "collapsed": true }, "outputs": [], "source": [ "communes = [\"59910\", \"59166\", \"59560\", \"59170\", \"59510\", \"59250\", \"59510\", \"59390\", \"59115\", \n", " \"59126\", \"59390\", \"59420\", \"59960\", \"59223\", \"59100\", \"59390\", \"59390\", \"59200\", \n", " \"59290\", \"59150\", \"59117\", \"59780\"]" ] }, { "cell_type": "code", "execution_count": 230, "metadata": { "collapsed": false }, "outputs": [], "source": [ "df = pd.DataFrame([extract_information(doc) for doc in doctors], columns=['Nom', u'Adresse', u\"Téléphone\", u\"Honoraires\", \"Convention\"])" ] }, { "cell_type": "code", "execution_count": 232, "metadata": { "collapsed": true }, "outputs": [], "source": [ "df['Commune'] = pd.Series(['51111'] * df.shape[0] , index=df.index)" ] }, { "cell_type": "code", "execution_count": 233, "metadata": { "collapsed": false }, "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", "
NomAdresseTéléphoneHonorairesConventionCommune
0 DRYLEWICZ JOEL 87 RUE DE GERGOVIE 75014 PARIS 01 45 45 32 12 Honoraires sans dépassement Conventionné secteur 1 51111
1 BOUMENDIL JULIEN 142 BOULEVARD DU MONTPARNASSE 75014 PARIS 01 43 20 91 75 Honoraires libres Conventionné secteur 2 51111
2 SARFATI ADRIEN 10 RUE DAGUERRE 75014 PARIS 01 43 35 41 03 Honoraires libres Conventionné secteur 2 51111
3 PIETRINI DOMINIQUE SARL SARRETTE 29 RUE SARRETTE 75014 PARIS 01 56 53 58 58 Honoraires libres Conventionné secteur 2 51111
4 TAZARTES MICHEL 142 BOULEVARD DU MONTPARNASSE 75014 PARIS 01 43 20 91 75 Honoraires libres Conventionné secteur 2 51111
5 MONNET DOMINIQUE HOPITAL COCHIN 27 RUE DU FBG SAINT JACQUES 750... 01 58 41 21 91 Honoraires libres Conventionné secteur 2 51111
\n", "
" ], "text/plain": [ " Nom Adresse \\\n", "0 DRYLEWICZ JOEL 87 RUE DE GERGOVIE 75014 PARIS \n", "1 BOUMENDIL JULIEN 142 BOULEVARD DU MONTPARNASSE 75014 PARIS \n", "2 SARFATI ADRIEN 10 RUE DAGUERRE 75014 PARIS \n", "3 PIETRINI DOMINIQUE SARL SARRETTE 29 RUE SARRETTE 75014 PARIS \n", "4 TAZARTES MICHEL 142 BOULEVARD DU MONTPARNASSE 75014 PARIS \n", "5 MONNET DOMINIQUE HOPITAL COCHIN 27 RUE DU FBG SAINT JACQUES 750... \n", "\n", " Téléphone Honoraires Convention Commune \n", "0 01 45 45 32 12 Honoraires sans dépassement Conventionné secteur 1 51111 \n", "1 01 43 20 91 75 Honoraires libres Conventionné secteur 2 51111 \n", "2 01 43 35 41 03 Honoraires libres Conventionné secteur 2 51111 \n", "3 01 56 53 58 58 Honoraires libres Conventionné secteur 2 51111 \n", "4 01 43 20 91 75 Honoraires libres Conventionné secteur 2 51111 \n", "5 01 58 41 21 91 Honoraires libres Conventionné secteur 2 51111 " ] }, "execution_count": 233, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df" ] }, { "cell_type": "code", "execution_count": 245, "metadata": { "collapsed": false }, "outputs": [], "source": [ "dfs = []\n", "for city in communes:\n", " df = make_query(\"ophtalmologiste\", city)\n", " if df is not None:\n", " df['Commune'] = pd.Series([city] * df.shape[0] , index=df.index)\n", " dfs.append(df)" ] }, { "cell_type": "code", "execution_count": 254, "metadata": { "collapsed": false }, "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", "
NomAdresseTéléphoneHonorairesConvention
Commune
59170 DRUMARE BOUVET ISABELLE CABINET DU DR ISABELLE DRUMARE BOUVET 6 RUE HE... 03 20 98 26 14 Honoraires avec dépassements maîtrisés (contra... Conventionné secteur 1 avec contrat d'accès au...
59170 DUMORTIER DOMINIQUE CABINET DU DR DOMINIQUE MARTIN 6 RUE HENRI GHE... 03 20 98 26 14 Honoraires sans dépassement Conventionné secteur 1
59170 GUILLEMOT ODILE CABINET DU DR ODILE GUILLEMOT BOUTET 6 RUE HEN... 03 20 98 26 14 Honoraires sans dépassement Conventionné secteur 1
59170 KARKOUTLY REZVOY CELINE CLINIQUE DU PARC CROIX CLINIQUE DU PARC 34 AVE... 03 20 99 41 41 Honoraires libres Conventionné secteur 2
59100 GEVART FREDERIC CABINE DU DR CELINE KARKOUTLY PARC DES 7 LIEUE... Honoraires libres Conventionné secteur 2 None
59100 GEVART FREDERIC CABINET DU DR CHRISTIAN DOUCET 72 RUE DU COQ F... Honoraires libres Conventionné secteur 2 None
59100 GEVART FREDERIC CABINET DU DR OLIVIER LAFFINEUR 72 RUE DU COQ ... Honoraires libres Conventionné secteur 2 None
59100 GEVART FREDERIC SELARL DIDIER MOUTON 72 RUE DU COQ FRANCAIS 59... 03 20 70 59 29 Honoraires libres Conventionné secteur 2
59100 MOUTON DIDIER SELARL DIDIER MOUTON 72 RUE DU COQ FRANCAIS 59... 03 20 70 59 29 Honoraires libres Conventionné secteur 2
59100 CAB MEDICAL OPHTALMOLOGIQUE MUTUALISTE CAB MEDICAL OPHTALMOLOGIQUE MUTUALISTE 30 BVD ... None None None
59100 DOUCET CHRISTIAN CABINET DU DR CHRISTIAN DOUCET 72 RUE DU COQ F... 03 20 70 59 29 Honoraires libres Conventionné secteur 2
59100 LENTINI FERDINANDO CABINETDU DR FERDINANDO LENTINI ENTREE A 19 RU... 03 20 94 80 59 Honoraires avec dépassements maîtrisés (contra... Conventionné secteur 2 avec contrat d'accès au...
59100 LAFFINEUR OLIVIER CABINET DU DR OLIVIER LAFFINEUR 72 RUE DU COQ ... 03 20 70 59 29 Honoraires sans dépassement Conventionné secteur 1
59100 KARKOUTLY REZVOY CELINE CABINET DU DR CELINE KARKOUTLY PARC DES 7 LIEU... 03 20 70 59 29 Honoraires libres Conventionné secteur 2
59100 MALBREL PIERRE HENRI 50 AVENUE LINNE 59100 ROUBAIX 03 20 75 82 43 Honoraires avec dépassements maîtrisés (contra... Conventionné secteur 1 avec contrat d'accès au...
59200 OUKAID MOHAMED 26 BOULEVARD GAMBETTA 59200 TOURCOING 03 20 26 41 21 Honoraires sans dépassement Conventionné secteur 1
59200 OUKAID MOHAMED CLINIQUE DE LA VICTOIRE CL.DE LA VICTOIRE 1 QU... Honoraires sans dépassement Conventionné secteur 1 None
59200 SIX ALAIN CABINET DU DR ALAIN SIX ASSO.OPHTALMO.DU BEFFR... 03 20 27 27 51 Honoraires avec dépassements maîtrisés (contra... Conventionné secteur 2 avec contrat d'accès au...
59200 SIX ALAIN CLINIQUE DE LA VICTOIRE CLINIQUE DE LA VICTOIR... Honoraires avec dépassements maîtrisés (contra... Conventionné secteur 2 avec contrat d'accès au... None
59200 BADGUERAHANIAN CHRISTOPHE 26 BOULEVARD GAMBETTA 59200 TOURCOING 03 20 26 41 21 Honoraires sans dépassement Conventionné secteur 1
59200 PAYEN PHILIPPE CABINET DU DR PHILIPPE PAYEN ASS.OPHTALMO.DU B... 03 20 27 27 51 Honoraires avec dépassements maîtrisés (contra... Conventionné secteur 2 avec contrat d'accès au...
59200 COLLIN FLORENCE CLINIQUE DE LA VICTOIRE 1 QUAI DU HAVRE 59200 ... Honoraires libres Conventionné secteur 2 None
59200 COLLIN FLORENCE CABINET DU DR FLORENCE COLLIN ASSO.OPHTALMO.DU... 03 20 27 27 51 Honoraires libres Conventionné secteur 2
59200 PICQUE PATRICK CABINET DU DR PATRICK PICQUE ASS.OPTHALMO.DU B... 03 20 27 27 51 Honoraires avec dépassements maîtrisés (contra... Conventionné secteur 2 avec contrat d'accès au...
59200 DE BEER FRANCOIS CABINET DU DR FRANCOIS DE BEER ASSO.OPHTALMO.D... 03 20 27 27 51 Honoraires sans dépassement Conventionné secteur 1
\n", "
" ], "text/plain": [ " Nom \\\n", "Commune \n", "59170 DRUMARE BOUVET ISABELLE \n", "59170 DUMORTIER DOMINIQUE \n", "59170 GUILLEMOT ODILE \n", "59170 KARKOUTLY REZVOY CELINE \n", "59100 GEVART FREDERIC \n", "59100 GEVART FREDERIC \n", "59100 GEVART FREDERIC \n", "59100 GEVART FREDERIC \n", "59100 MOUTON DIDIER \n", "59100 CAB MEDICAL OPHTALMOLOGIQUE MUTUALISTE \n", "59100 DOUCET CHRISTIAN \n", "59100 LENTINI FERDINANDO \n", "59100 LAFFINEUR OLIVIER \n", "59100 KARKOUTLY REZVOY CELINE \n", "59100 MALBREL PIERRE HENRI \n", "59200 OUKAID MOHAMED \n", "59200 OUKAID MOHAMED \n", "59200 SIX ALAIN \n", "59200 SIX ALAIN \n", "59200 BADGUERAHANIAN CHRISTOPHE \n", "59200 PAYEN PHILIPPE \n", "59200 COLLIN FLORENCE \n", "59200 COLLIN FLORENCE \n", "59200 PICQUE PATRICK \n", "59200 DE BEER FRANCOIS \n", "\n", " Adresse \\\n", "Commune \n", "59170 CABINET DU DR ISABELLE DRUMARE BOUVET 6 RUE HE... \n", "59170 CABINET DU DR DOMINIQUE MARTIN 6 RUE HENRI GHE... \n", "59170 CABINET DU DR ODILE GUILLEMOT BOUTET 6 RUE HEN... \n", "59170 CLINIQUE DU PARC CROIX CLINIQUE DU PARC 34 AVE... \n", "59100 CABINE DU DR CELINE KARKOUTLY PARC DES 7 LIEUE... \n", "59100 CABINET DU DR CHRISTIAN DOUCET 72 RUE DU COQ F... \n", "59100 CABINET DU DR OLIVIER LAFFINEUR 72 RUE DU COQ ... \n", "59100 SELARL DIDIER MOUTON 72 RUE DU COQ FRANCAIS 59... \n", "59100 SELARL DIDIER MOUTON 72 RUE DU COQ FRANCAIS 59... \n", "59100 CAB MEDICAL OPHTALMOLOGIQUE MUTUALISTE 30 BVD ... \n", "59100 CABINET DU DR CHRISTIAN DOUCET 72 RUE DU COQ F... \n", "59100 CABINETDU DR FERDINANDO LENTINI ENTREE A 19 RU... \n", "59100 CABINET DU DR OLIVIER LAFFINEUR 72 RUE DU COQ ... \n", "59100 CABINET DU DR CELINE KARKOUTLY PARC DES 7 LIEU... \n", "59100 50 AVENUE LINNE 59100 ROUBAIX \n", "59200 26 BOULEVARD GAMBETTA 59200 TOURCOING \n", "59200 CLINIQUE DE LA VICTOIRE CL.DE LA VICTOIRE 1 QU... \n", "59200 CABINET DU DR ALAIN SIX ASSO.OPHTALMO.DU BEFFR... \n", "59200 CLINIQUE DE LA VICTOIRE CLINIQUE DE LA VICTOIR... \n", "59200 26 BOULEVARD GAMBETTA 59200 TOURCOING \n", "59200 CABINET DU DR PHILIPPE PAYEN ASS.OPHTALMO.DU B... \n", "59200 CLINIQUE DE LA VICTOIRE 1 QUAI DU HAVRE 59200 ... \n", "59200 CABINET DU DR FLORENCE COLLIN ASSO.OPHTALMO.DU... \n", "59200 CABINET DU DR PATRICK PICQUE ASS.OPTHALMO.DU B... \n", "59200 CABINET DU DR FRANCOIS DE BEER ASSO.OPHTALMO.D... \n", "\n", " Téléphone \\\n", "Commune \n", "59170 03 20 98 26 14 \n", "59170 03 20 98 26 14 \n", "59170 03 20 98 26 14 \n", "59170 03 20 99 41 41 \n", "59100 Honoraires libres \n", "59100 Honoraires libres \n", "59100 Honoraires libres \n", "59100 03 20 70 59 29 \n", "59100 03 20 70 59 29 \n", "59100 None \n", "59100 03 20 70 59 29 \n", "59100 03 20 94 80 59 \n", "59100 03 20 70 59 29 \n", "59100 03 20 70 59 29 \n", "59100 03 20 75 82 43 \n", "59200 03 20 26 41 21 \n", "59200 Honoraires sans dépassement \n", "59200 03 20 27 27 51 \n", "59200 Honoraires avec dépassements maîtrisés (contra... \n", "59200 03 20 26 41 21 \n", "59200 03 20 27 27 51 \n", "59200 Honoraires libres \n", "59200 03 20 27 27 51 \n", "59200 03 20 27 27 51 \n", "59200 03 20 27 27 51 \n", "\n", " Honoraires \\\n", "Commune \n", "59170 Honoraires avec dépassements maîtrisés (contra... \n", "59170 Honoraires sans dépassement \n", "59170 Honoraires sans dépassement \n", "59170 Honoraires libres \n", "59100 Conventionné secteur 2 \n", "59100 Conventionné secteur 2 \n", "59100 Conventionné secteur 2 \n", "59100 Honoraires libres \n", "59100 Honoraires libres \n", "59100 None \n", "59100 Honoraires libres \n", "59100 Honoraires avec dépassements maîtrisés (contra... \n", "59100 Honoraires sans dépassement \n", "59100 Honoraires libres \n", "59100 Honoraires avec dépassements maîtrisés (contra... \n", "59200 Honoraires sans dépassement \n", "59200 Conventionné secteur 1 \n", "59200 Honoraires avec dépassements maîtrisés (contra... \n", "59200 Conventionné secteur 2 avec contrat d'accès au... \n", "59200 Honoraires sans dépassement \n", "59200 Honoraires avec dépassements maîtrisés (contra... \n", "59200 Conventionné secteur 2 \n", "59200 Honoraires libres \n", "59200 Honoraires avec dépassements maîtrisés (contra... \n", "59200 Honoraires sans dépassement \n", "\n", " Convention \n", "Commune \n", "59170 Conventionné secteur 1 avec contrat d'accès au... \n", "59170 Conventionné secteur 1 \n", "59170 Conventionné secteur 1 \n", "59170 Conventionné secteur 2 \n", "59100 None \n", "59100 None \n", "59100 None \n", "59100 Conventionné secteur 2 \n", "59100 Conventionné secteur 2 \n", "59100 None \n", "59100 Conventionné secteur 2 \n", "59100 Conventionné secteur 2 avec contrat d'accès au... \n", "59100 Conventionné secteur 1 \n", "59100 Conventionné secteur 2 \n", "59100 Conventionné secteur 1 avec contrat d'accès au... \n", "59200 Conventionné secteur 1 \n", "59200 None \n", "59200 Conventionné secteur 2 avec contrat d'accès au... \n", "59200 None \n", "59200 Conventionné secteur 1 \n", "59200 Conventionné secteur 2 avec contrat d'accès au... \n", "59200 None \n", "59200 Conventionné secteur 2 \n", "59200 Conventionné secteur 2 avec contrat d'accès au... \n", "59200 Conventionné secteur 1 " ] }, "execution_count": 254, "metadata": {}, "output_type": "execute_result" } ], "source": [ "df = pd.concat(dfs)\n", "df = df.set_index('Commune')\n", "df" ] }, { "cell_type": "code", "execution_count": 255, "metadata": { "collapsed": false }, "outputs": [], "source": [ "df.to_csv(\"files/ophtalmologistes_59.csv\", encoding='utf-8')" ] } ], "metadata": { "kernelspec": { "display_name": "Python 2", "language": "python", "name": "python2" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 2 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython2", "version": "2.7.8" } }, "nbformat": 4, "nbformat_minor": 0 }