<jupyter_start><jupyter_text>Load processed db<jupyter_code>data=pd.read_excel('data/clean/erdely6.xlsx').drop('Unnamed: 0',axis=1)
geo_data={}
to_geo=(data['Denumire'].astype(str)+'###'+data['Denumire'].astype(str)+' '+data['Localitate'].astype(str)+', '+data['Localitate superioară'].astype(str)+', '+\
     data['Stradă'].astype(str)+' nr. '+data['Număr'].astype(str)+', '+data['Cod poștal'].astype(str).str[:-2]+', '+\
     data['Judet'].astype(str)+', ROMANIA').unique()
from pygeocoder import Geocoder
apikey='<KEY>'
pygeo = Geocoder(api_key=apikey)
# !pip install python-google-places
from googleplaces import GooglePlaces, types, lang
google_places = GooglePlaces(apikey)
lang='hu'
for i,q in enumerate(to_geo):
    school=q.split('###')[0]
    q=q.split('###')[1]
    if q not in geo_data:
        d={}
        print(i,'Processing...',q)
        try:
            result= pygeo.geocode(q,language=lang)
            d['koordinata']=result.coordinates
            d['cim']=result.formatted_address
            d['varos']=result.city
            d['telepules']=result.administrative_area_level_2
            d['megye']=result.administrative_area_level_1
            d['orszag']=result.country
        except:
            print('No detailed info for',q)
        try:
            query_result = google_places.nearby_search(
                location=q, keyword=school,type='school',
                radius=20,language=lang)
            if query_result.places:
                place=query_result.places[0]
                place.get_details()
                d['nev']=place.name
                d['telefon']=place.international_phone_number
                d['web']=place.website
                d['maps']=place.url
                if place.photos:
                    photo = place.photos[0]    
                    photo.get(maxheight=500, maxwidth=500)
                    d['kep']=photo.url
        except:
            print('No detailed info for',q)
        geo_data[q]=d
pd.DataFrame(geo_data).T.reset_index().to_excel('data/clean/geo.xlsx')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.16321617717862302, 'fraction_numerical': 0.008666345690900338, 'mean_word_length': 2.6649029982363315, 'pattern_counts': {'":': 0, '<': 6, '<?xml version=': 0, '>': 6, 'https://': 0, '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': '402962', 'license': 'MIT', 'n_tokens_mistral': 723, 'n_tokens_neox': 682, 'n_words': 90, 'path': 'test/suli/A5-geocoder.ipynb', 'repo_name': 'csaladenes/csaladenes.github.io', 'size': '2111'}