Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

255
Views
parsing table of emergency numbers from wikipedia

I am trying to write a javascript snippet to parse the data from the tables on this page: https://en.wikipedia.org/wiki/List_of_emergency_telephone_numbers

I found dbpedia which seems promising, but it seems as if their system ignores the tables: https://dbpedia.org/describe/?url=http%3A%2F%2Fdbpedia.org%2Fresource%2FList_of_emergency_telephone_numbers&invfp=IFP_OFF&sas=SAME_AS_OFF&sid=868

Does anybody know an alternative way to parse the data.

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

python to the rescue, I couldn't find an easy way to do this in javascript but in python.

I found an easier to parse table here: https://www.adducation.info/general-knowledge-travel-and-transport/emergency-numbers/ But it is still an html table and I want to use it in Javascript, so JSON is easier. This code solves my problem:

import pandas as pd
data = pd.read_html("emergency_numbers.html")[0]
json_data = data.to_json(orient="records")
with open("emergency_numbers.json", "w") as f:
    f.write(json_data)

result is:

  [ { 'Country / Territory'            : '\ud83c\udde6\ud83c\uddeb Afghanistan'
    , '\u260e Emergency'               : null
    , '\u260e Police'                  : '119'
    , '\u260e Ambulance'               : '119, 102'
    , '\u260e Fire'                    : '112, 119'
    , 'Group'                          : 'Asia'
    , 'Calling codes'                  : '+93'
    , 'Local emergency numbers & info' : 'You can dial 020 112 from mobile but only in Kabul.'
    } 
  , { 'Country / Territory'            : '\ud83c\udde6\ud83c\uddf1 Albania'
    , '\u260e Emergency'               : null
    , '\u260e Police'                  : '129'
    , '\u260e Ambulance'               : '127'
    , '\u260e Fire'                    : '128'
    , 'Group'                          : 'Europe'
    , 'Calling codes'                  : '+355'
    , 'Local emergency numbers & info' : null
    } 
  , { 'Country / Territory'            : '\ud83c\udde9\ud83c\uddff Algeria'
    , '\u260e Emergency'               : null
    , '\u260e Police'                  : '17'
    , '\u260e Ambulance'               : '14'
    , '\u260e Fire'                    : '14'
    , 'Group'                          : 'Africa'
    , 'Calling codes'                  : '+213'
    , 'Local emergency numbers & info' : 'Dial 1548 for tourist police.'
    } 
  , { 'Country / Territory'            : '\ud83c\udde6\ud83c\uddf8 American Samoa'
    , '\u260e Emergency'               : '911'
    , '\u260e Police'                  : null
    , '\u260e Ambulance'               : null
    , '\u260e 
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!