<jupyter_start><jupyter_text>End-To-End Example: Google Restaurants MapLet's import our google functions and then use folium to plot restaurants on a map.<jupyter_code>import requests 
import pandas as pd
import folium
import import_ipynb
import googleapi 
from IPython.display import display, HTML
from ipywidgets import interact, interactive, fixed, interact_manual
import ipywidgets as widgets
google_key = '751838d6b9978955679461c80a7df60bde4f093d'
def geocode(location):
    '''
    using geocoding here: https://nominatim.openstreetmap.org/search
    '''
    query_string = {'q' : location, 'format' :'json'}
    url = 'https://nominatim.openstreetmap.org/search'
    response = requests.get(url, params = query_string)
    data = response.json()
    if type(data) == list:
        return data[0]
    else:
        return data
    
display(HTML("<h1>Yummy.com Restaurants</h1>"))
interact_zomato=interact.options(manual=True, manual_name="Find Eateries!")
@interact_zomato(cuisine="", city="")
def main(cuisine,city):
    geo = geocode(city)
    rests = googleapi.googlePlacesSearch(google_key, geo['lat'], geo['lon'], "restaurant", keyword=cuisine)
    rests_df = pd.json_normalize(rests)
    MAPCITY = (geo['lat'], geo['lon'])
    rmap = folium.Map(location=MAPCITY, zoom_start=10, width=800, height=600)
                    
    for row in rests_df.to_records():
        coords = (float(row['geometry.location.lat']),float(row['geometry.location.lng']))
        loc = f"<p><b>{row['name']}</b><br>{row['rating']}</p>"
        if row['rating'] > 4:
            color = "lightgreen"
        elif row['rating'] > 3:
            color = 'green'
        else:
            color = 'darkgreen'            
        marker = folium.Marker(location=coords, popup=loc,tooltip=loc, icon=folium.Icon(color=color))
        rmap.add_child(marker)
    display(rmap)<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.13559322033898305, 'fraction_numerical': 0.022245762711864406, 'mean_word_length': 3.7702020202020203, 'pattern_counts': {'":': 0, '<': 12, '<?xml version=': 0, '>': 14, 'https://': 2, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, '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': '642108', 'license': 'Apache-2.0', 'n_tokens_mistral': 663, 'n_tokens_neox': 624, 'n_words': 129, 'path': 'lessons/13-visualization/ETEE-Interactive-Map.ipynb', 'repo_name': 'IST256/spring2022', 'size': '1888'}