<jupyter_start><jupyter_text>Iran's Earthquakes Map<jupyter_code>import xml.etree.ElementTree as ElementTree
import pandas as pd
import requests
# get 20 latest earthquake reports
r = requests.get('http://irsc.ut.ac.ir/events_list.xml')
# Check if our request is OK
r.status_code
# Converting Eastern Arabic numbers to Western Arabic numbers - https://stackoverflow.com/a/14506662/846210
table = {1776: 48,  # 0 
         1777: 49,  # 1
         1778: 50,  # 2
         1779: 51,  # 3
         1780: 52,  # 4
         1781: 53,  # 5
         1782: 54,  # 6
         1783: 55,  # 7
         1784: 56,  # 8
         1785: 57}  # 9

def translate_to_western(x):
    return x.translate(table)
root = ElementTree.fromstring(r.content)
all_records = []
for i, child in enumerate(root):
    record = {}
    for subchild in child:
        record[subchild.tag] = subchild.text
    all_records.append(record)
df = pd.DataFrame(all_records)
# df = df.applymap(translate_to_western)
df
# Lets load bokeh!

from bokeh.io import output_notebook, show
from bokeh.models import (
  GMapPlot, GMapOptions, ColumnDataSource, Circle, Range1d, PanTool, WheelZoomTool, BoxSelectTool
)

output_notebook()
lats = df['lat'].apply(lambda x: x.split(' ')[0])
longs = df['long'].apply(lambda x: x.split(' ')[0])
# from Bokeh samples

map_options = GMapOptions(lat=35.68, lng=50.95, map_type="roadmap", zoom=10)

plot = GMapPlot(x_range=Range1d(), y_range=Range1d(), map_options=map_options)
plot.title.text = "Iran"

# For GMaps to function, Google requires you obtain and enable an API key:
#
#     https://developers.google.com/maps/documentation/javascript/get-api-key
#
# Replace the value below with your personal API key:
plot.api_key = "API-KEY-HERE"


source = ColumnDataSource(
    data=dict(
        lat=lats,
        lon=longs,
    )
)

circle = Circle(x="lon", y="lat", size=10, fill_color="red", fill_alpha=0.8, line_color=None)
plot.add_glyph(source, circle)

plot.add_tools(PanTool(), WheelZoomTool(), BoxSelectTool())

plot.width = 1280
plot.height = 720

show(plot)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.12805755395683452, 'fraction_numerical': 0.05371702637889688, 'mean_word_length': 3.7409090909090907, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '1', 'dir': 'jupyter-structured-clean-dedup', 'id': '216392', 'license': 'MIT', 'n_tokens_mistral': 829, 'n_tokens_neox': 739, 'n_words': 182, 'path': 'old:misc/my shaky country/iran-earthquakes-map.ipynb', 'repo_name': 'taesiri/noteobooks', 'size': '2085'}