-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcode 2.py
More file actions
28 lines (26 loc) · 868 Bytes
/
code 2.py
File metadata and controls
28 lines (26 loc) · 868 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# -*- coding: utf-8 -*-
"""
Created on Fri Oct 25 01:34:46 2024
@author: harpr
https://www.datacamp.com/tutorial/geocoding-for-data-scientists
"""
#%%
import pandas as pd
import geopy
#%%
from geopy.geocoders import Nominatim
geolocator = Nominatim(user_agent="bainselly95@gmail.com")
Address_table=pd.DataFrame()
Street = input("Enter the Street Address")
City = input("Enter the City Name")
State = input("Enter the State name")
Country = input("Country name")
address1_osm= (str(Street)+" "+str(City)+" "+str(State)+" "+str(Country))
print(address1_osm)
location = geolocator.geocode(address1_osm)
print(location)
print('Latitude: '+str(location.latitude)+', Longitude: '+str(location.longitude))
#%%
Address = pd.DataFrame({'Street':[Street],'City':[City],'State':[State],'Country':[Country]})
DF=pd.concat([Address_table,Address])
#%%