Find nearest film scene location in NYC




Pay Notebook Creator: Eva Wang11
Set Container: Numerical CPU with TINY Memory for 10 Minutes 0
Total0
In [2]:
#CrossCompute
target_folder = '/tmp'
In [3]:
# load table
import pandas as pd
t = pd.read_csv('Interactive_Map_Data.csv', encoding='latin-1', skiprows=1)
In [4]:
#get address
address = '1472 Broadway, New York, NY 10036'
user_number = "+17188380942"
#convert address to latitude and longtitude
from geopy.geocoders import Nominatim
geolocator = Nominatim()
location = geolocator.geocode(address)
lat = location.latitude
long = location.longitude
 
#find to cloesest latitude and longtitude
lat_table = t.loc[abs(t['LATITUDE']-lat)< 0.01]
long_table = t.loc[abs(t['LONGITUDE']-long) < 0.01]
find_table = pd.merge(lat_table,long_table)

def f(c):
    return abs(c['LATITUDE']-lat) + abs(c['LONGITUDE']-long) 
find_table['sum'] = find_table.apply(f, axis = 1)
find_table.sort_values(['sum'],ascending=True)

find_table.head(6)
Out[4]:
<style scoped> .dataframe tbody tr th:only-of-type { vertical-align: middle; } .dataframe tbody tr th { vertical-align: top; } .dataframe thead th { text-align: right; } </style>
Film Year URL Encoded name Image File Name Agency Credit Artist Credit Director/Filmmaker Name Director/Filmmaker IMDB Link Location Display Text LATITUDE ... Scene Type Media IMDB LINK Client or book location indicator Notes Book Image Book Page Display? IMAGE OF LOCATION sum
0 13 Going on 30 2004 13%20Going%20on%2030 13Goingon30_ec Courtesy of Everett Collection, Inc. Directed by Gary Winick http://imdb.com/name/nm0935095/ W. 47th St. and Seventh Ave.<br>Times Square<b... 40.759220 ... NaN Film http://www.imdb.com/title/tt0337563/ 47th St. and 7th Ave. Times Square\nManhattan NaN Y 239 NaN Y 0.004229
1 Broadway Danny Rose 1984 Broadway%20Danny%20Rose BroadwayDannyRose_pf Courtesy of Photofest Directed by Woody Allen http://www.imdb.com/name/nm0000095/ Carnegie Deli at 854 Seventh Ave.<br>Midtown<b... 40.764073 ... NaN Film http://www.imdb.com/title/tt0087003/ Carnegie Deli - 7th Avenue at 55th Street poor quality Y 158 NaN Y 0.012415
2 Death to Smoochy 2002 Death%20to%20Smoochy NaN NaN Directed by Danny DeVito http://imdb.com/name/nm0000362/ Seventh Ave. and 48th St.<br>Times Square<br>M... 40.759800 ... NaN Film http://www.imdb.com/title/tt0266452/ Times Square Additional image p10-11 Y 6/238 NaN N 0.005230
3 Downtown 81 / New York Beat Movie 1981 Downtown%2081%20%2F%20New%20York%20Beat%20Movie Downtown81_2_pf Courtesy of Photofest Directed by Edo Bertoglio http://imdb.com/name/nm0078166/ The Empire State Building<br>Midtown<br>Manhattan 40.748346 ... NaN Film http://www.imdb.com/title/tt0208993/ The Empire State building, 34th St and 5th Avenue NaN N 125 NaN Y 0.009120
4 Fame 1980 Fame NaN NaN Directed by Alan Parker http://imdb.com/name/nm0000570/ High School of the Performing Arts<br>120 W. 4... 40.757566 ... NaN Film http://www.imdb.com/title/tt0080716/ 46th street bet 6th ave and broadway NaN Y 115 NaN N 0.004149
5 Godspell 1973 Godspell Godspell4_pf Courtesy of Photofest Directed by David Greene http://imdb.com/name/nm0338719/ Times Square<br>Manhattan 40.759318 ... NaN Film http://www.imdb.com/title/tt0070121/ Accutron Watch Sign, Times Square poor quality Y 72-73 NaN Y 0.004101
<p>6 rows × 23 columns</p>
In [5]:
message_body = "<< " + find_table.head(6)['Film']+ " >>" +" address is " +find_table.head(6)['Location Display Text']
string = message_body.any().replace('<br>','')
In [6]:
#load map
#mark addresses on the map
target_path = target_folder + '/map.csv'
find_table.head(6).to_csv(target_path, index=False)

print('asdf_geotable_path = %s' % target_path)

# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# use twilio api to send user message 
account_sid = "ACa2c9ff9c45d3bb4e4dd836e6d5ede729"
auth_token = "ff8ac3c95c12cfd287f1621a6afa90a2"

client = Client(account_sid, auth_token)

message = client.messages.create(
                                 body="Hey bro",
                                 to=user_number,
                                 from_="+13478538680")

print(message.sid)
asdf_geotable_path = /tmp/map.csv
---------------------------------------------------------------------------
ModuleNotFoundError                       Traceback (most recent call last)
<ipython-input-6-6b3f61ac6e77> in <module>()
      7 
      8 # Download the Python helper library from twilio.com/docs/python/install
----> 9 from twilio.rest import Client
     10 
     11 # use twilio api to send user message

ModuleNotFoundError: No module named 'twilio'
In [ ]:
 
In [ ]:
 
In [ ]:
 
In [ ]: