import pandas as pd
t = pd.read_csv('Interactive_Map_Data.csv', encoding='latin-1', skiprows=1)
t[:3]
t[(t['Film'] == '12 Angry Men') | (t['Film'] == '13 Going on 30')]
film_names = [
'12 Angry Men',
'13 Going on 30',
]
film_filter
t.columns
# Get distance between two points
from geopy.distance import vincenty as get_distance
get_distance
from geopy.distance import vincenty as get_distance
newport_ri = 41.49008, -71.312796
cleveland_oh = 41.499498, -81.695391
x = get_distance(newport_ri, cleveland_oh)
x
x.meters
# Convert address to longitude and latitude
import geopy
geocode = geopy.GoogleV3('AIzaSyDNqc0tWzXHx_wIp1w75-XTcCk4BSphB5w').geocode
location = geocode('10025')
location
location_ll = location.latitude, location.longitude
location_ll
# Add column to table
import pandas as pd
t = pd.DataFrame([
[1, 2],
[3, 4],
], columns=['a', 'b'])
t
t['c'] = [3, 5]
t
# Sort table by column
t.sort_values(['c'], ascending=False)
def f(row):
return row['a'] + row['b'] + row['c']
t['d'] = t.apply(f, axis=1)
t
t.sort_values(['d'], ascending=False)
t
# Add column that is the distance of each row from the geocoded address
# Define address as a user argument in the first code cell
# Get latitude and longitude of the address
# Define function that computes distance of each row from the geocoded address
# Sort table by distance
# Get first six or seven rows of the table
# Save first six or seven rows of the table on the map
# Show the map