Prepare for Hurricane Elsa 20210706-1700




Pay Notebook Creator: Roy Hyunjin Han0
Set Container: Numerical CPU with TINY Memory for 10 Minutes 0
Total0
In [24]:
# pip install -U pandas
In [7]:
GOOGLE_KEY = 'AIzaSyDqR8ePmVqzh-wF3R89tsZyhCZjaTI_mFI'
In [8]:
from geopy.geocoders import GoogleV3
geocode = GoogleV3(api_key=GOOGLE_KEY).geocode
address = '4210 S Grandmarch Avenue, Homosassa, FL 34446'
location = geocode(address)
In [9]:
normalized_address = location.address
latitude = location.latitude
longitude = location.longitude
In [14]:
from pandas import read_csv
table_path = 'locations-20210706-1630.csv'
table = read_csv(table_path)
In [18]:
table[:3]
Out[18]:
<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>
Location Name Location Address Location County Zip Code Open Close Resources Type Source Organization Name
0 Homosassa Area Recreational Playground 4210 S Grandmarch Avenue, Homosassa, FL 34446 Citrus County, FL 34446 20210708-0800 NaN Sandbags NaN https://www.wfla.com/news/local-news/tropical-... Citrus County, FL
1 Dan’s Clam Stand 7500 W. Gulf to Lake Highway, Crystal River, F... Citrus County, FL 34429 20210708-0800 NaN Sandbags NaN https://www.wfla.com/news/local-news/tropical-... Citrus County, FL
2 Year-Round Self-Service Sandbag Site 1744 9th Avenue N, St. Petersburg, FL 33713 Pinellas County, FL 33713 NaN NaN NaN NaN https://www.wfla.com/news/local-news/tropical-... City of St. Petersburg, FL
In [22]:
geocode('7500 W. Gulf to Lake Highway, Crystal River, FL 34429')
Out[22]:
Location(7500 W Gulf to Lake Hwy, Crystal River, FL 34429, USA, (28.8954492, -82.5594854, 0.0))
In [26]:
def pinpoint_location(row):
    address = row['Location Address']
    location = geocode(address)
    longitude = location.longitude
    latitude = location.latitude
    row['Normalized Address'] = address
    row['Longitude'] = longitude
    row['Latitude'] = latitude
    return row

located_table = table.apply(pinpoint_location, axis=1)
In [27]:
located_table[:3]
Out[27]:
<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>
Location Name Location Address Location County Zip Code Open Close Resources Type Source Organization Name Normalized Address Longitude Latitude
0 Homosassa Area Recreational Playground 4210 S Grandmarch Avenue, Homosassa, FL 34446 Citrus County, FL 34446 20210708-0800 NaN Sandbags NaN https://www.wfla.com/news/local-news/tropical-... Citrus County, FL 4210 S Grandmarch Avenue, Homosassa, FL 34446 -82.568085 28.800981
1 Dan’s Clam Stand 7500 W. Gulf to Lake Highway, Crystal River, F... Citrus County, FL 34429 20210708-0800 NaN Sandbags NaN https://www.wfla.com/news/local-news/tropical-... Citrus County, FL 7500 W. Gulf to Lake Highway, Crystal River, F... -82.559485 28.895449
2 Year-Round Self-Service Sandbag Site 1744 9th Avenue N, St. Petersburg, FL 33713 Pinellas County, FL 33713 NaN NaN NaN NaN https://www.wfla.com/news/local-news/tropical-... City of St. Petersburg, FL 1744 9th Avenue N, St. Petersburg, FL 33713 -82.656868 27.780487
In [29]:
ls
 locations-20210706-1630.csv  'Prepare Locations 20210706-1615.ipynb'
In [46]:
normalized_table = located_table[[
    'Location Name',
    'Normalized Address',
    'Location County',
    'Open',
    'Close',
    'Resources',
    'Type',
    'Source',
    'Organization Name',
    'Longitude',
    'Latitude',
]]
normalized_table.to_csv('normalized-locations-20210706-1630.csv', index=False)
In [48]:
my_address = '5709 12th Ave S, Gulfport, FL 33707'
my_location = geocode(address)
my_longitude = my_location.longitude
my_latitude = my_location.latitude
my_lat_lon = my_latitude, my_longitude
In [49]:
from geopy.distance import distance

def get_distance(row):
    my_distance = distance((my_latitude, my_longitude), (row['Latitude'], row['Longitude']))
    row['Distance in Miles'] = my_distance.miles
    row['Distance in Meters'] = my_distance.m
    return row

distance_table = normalized_table.apply(get_distance, axis=1)
In [50]:
distance_table.iloc[0]
Out[50]:
Location Name                    Homosassa Area Recreational Playground
Normalized Address        4210 S Grandmarch Avenue, Homosassa, FL 34446
Location County                                       Citrus County, FL
Open                                                      20210708-0800
Close                                                               NaN
Resources                                                      Sandbags
Type                                                                NaN
Source                https://www.wfla.com/news/local-news/tropical-...
Organization Name                                     Citrus County, FL
Longitude                                                      -82.5681
Latitude                                                         28.801
Distance in Miles                                                72.315
Distance in Meters                                               116380
Name: 0, dtype: object
In [51]:
sorted_table = distance_table.sort_values('Distance in Meters')
In [53]:
filtered_table = sorted_table[sorted_table['Resources'] == 'Sandbags']
filtered_table
Out[53]:
<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>
Location Name Normalized Address Location County Open Close Resources Type Source Organization Name Longitude Latitude Distance in Miles Distance in Meters
5 Northwest Pool 2331 60th Street N, St. Petersburg, FL 33710 Pinellas County, FL 20210708-0900 NaN Sandbags NaN https://www.wfla.com/news/local-news/tropical-... City of St. Petersburg, FL -82.715788 27.792942 2.387880 3842.920458
4 James "JC" Turner Fields > South Side of Bartl... 643 22nd Avenue S, St. Petersburg, FL 33705 Pinellas County, FL 20210708-0900 NaN Sandbags NaN https://www.wfla.com/news/local-news/tropical-... City of St. Petersburg, FL -82.641473 27.748947 4.317530 6948.391605
30 Helen Howarth Park 6301 94th Ave, Pinellas Park, FL 33782 Pinellas Park, FL NaN NaN Sandbags NaN https://wusfnews.wusf.usf.edu/weather/2021-07-... Pinellas Park, FL -82.721753 27.858488 6.914832 11128.343934
3 Northeast Park > Cardinal Drive Entrance to Ma... 875 62nd Avenue NE, St. Petersburg, FL 33702 Pinellas County, FL 20210708-0900 NaN Sandbags NaN https://www.wfla.com/news/local-news/tropical-... City of St. Petersburg, FL -82.623047 27.830147 7.309101 11762.857864
31 Pinebrook Park 7202 118th Ave N, Largo, FL 33773 Pinellas Park, FL NaN NaN Sandbags NaN https://wusfnews.wusf.usf.edu/weather/2021-07-... Pinellas Park, FL -82.736969 27.878549 8.415505 13543.443271
28 Walsingham Park 2615 102nd Avenue, Seminole, FL 33778 Pinellas County, FL 20210708-0700 20210708-1200 Sandbags NaN https://www.wfla.com/news/local-news/tropical-... Pinellas County, FL -82.796818 27.865507 9.044495 14555.703549
12 E.G. Simmons Conservation Park 2401 19th Avenue NW, Ruskin, FL 33570 Hillsborough County, FL 20210708-0800 20210708-1200 Sandbags NaN https://www.wfla.com/news/local-news/tropical-... Hillsborough County, FL -82.464309 27.735377 15.204282 24468.919897
7 Himes Avenue Complex 4501 S. Himes Avenue, Tampa, FL 33611 Hillsborough County, FL 20210708-0800 20210708-1200 Sandbags NaN https://www.wfla.com/news/local-news/tropical-... City of Tampa, FL -82.502134 27.899951 16.078913 25876.502682
21 Manatee Beach Parking Lot 4000 Gulf Drive, Holmes Beach, FL 34217 Manatee County, FL 20210708-0800 NaN Sandbags Pre Made https://www.wfla.com/news/local-news/tropical-... Manatee County, FL -82.712226 27.497371 17.981323 28938.133868
8 MacFarlane Park 1700 North MacDill Avenue, Tampa, FL 33607 Hillsborough County, FL 20210708-0800 20210708-1200 Sandbags NaN https://www.wfla.com/news/local-news/tropical-... City of Tampa, FL -82.495182 27.958238 19.073430 30695.709894
20 GT Bray Park > Parking Lot 5502 33rd Avenue Drive W, Bradenton, FL 34209 Manatee County, FL 20210708-0800 NaN Sandbags Full Service https://www.wfla.com/news/local-news/tropical-... Manatee County, FL -82.616807 27.473956 20.429650 32878.335052
29 John Chesnut Sr. Park 2200 East Lake Road, Palm Harbor, FL 34685 Pinellas County, FL 20210708-0700 20210708-1200 Sandbags NaN https://www.wfla.com/news/local-news/tropical-... Pinellas County, FL -82.700987 28.083319 22.374518 36008.295850
6 Al Barnes Park South 2902 N. 32nd Street, Tampa, FL 33605 Hillsborough County, FL 20210708-0800 20210708-1200 Sandbags NaN https://www.wfla.com/news/local-news/tropical-... City of Tampa, FL -82.425218 27.969374 22.736540 36590.913542
13 Ed Radice Park 14720 Ed Radice Drive, Tampa, FL 33626 Hillsborough County, FL 20210708-0800 20210708-1200 Sandbags NaN https://www.wfla.com/news/local-news/tropical-... Hillsborough County, FL -82.608562 28.083198 23.221069 37370.687869
19 Public Works Department Stormwater Facility 5511 39th Street E, Bradenton, FL 34203 Manatee County, FL 20210708-0800 NaN Sandbags Self Service https://www.wfla.com/news/local-news/tropical-... Manatee County, FL -82.513277 27.442340 24.924909 40112.752656
9 Youth Sports Complex 10369 US Highway 301, Temple Terrace, FL 33637 Hillsborough County, FL 20210708-0800 20210708-1200 Sandbags NaN https://www.wfla.com/news/local-news/tropical-... City of Temple Terrace -82.346744 28.041187 29.593659 47626.377748
24 W. H. Jack Mitchell, Jr., Park 4825 Little Rd, New Port Richey, FL 34655 Pasco County, FL NaN NaN Sandbags NaN https://wusfnews.wusf.usf.edu/weather/2021-07-... Pasco County, FL -82.666937 28.229837 32.567594 52412.461865
26 Magnolia Valley Golf Course 7223 Massachusetts Ave, New Port Richey, FL 34653 Pasco County, FL NaN NaN Sandbags NaN https://wusfnews.wusf.usf.edu/weather/2021-07-... Pasco County, FL -82.693686 28.262636 34.730377 55893.123833
11 Edward Medard Conservation Park 6140 Turkey Creek Road, Plant City, FL 33567 Hillsborough County, FL 20210708-0800 20210708-1200 Sandbags NaN https://www.wfla.com/news/local-news/tropical-... Hillsborough County, FL -82.170438 27.923121 34.982243 56298.462215
32 Twin Lakes Park 6700 Clark Road, Sarasota, FL 34241 Sarasota County, FL NaN NaN Sandbags NaN https://www.wfla.com/news/local-news/tropical-... Sarasota County, FL -82.438713 27.264578 37.899521 60993.366875
25 Veterans Memoria Park 14333 Hicks Road, Hudson, FL 34669 Pasco County, FL NaN NaN Sandbags NaN https://wusfnews.wusf.usf.edu/weather/2021-07-... Pasco County, FL -82.652395 28.365803 41.972050 67547.466636
27 Pasco County Public Works (C-Barn) 30908 Warder Street, San Antonio, FL 33576 Pasco County, FL NaN NaN Sandbags NaN https://wusfnews.wusf.usf.edu/weather/2021-07-... Pasco County, FL -82.305832 28.330614 46.530520 74883.613781
10 Linda Pedersen Park 6300 Shoal Line Boulevard, Spring Hill, FL 34607 Hernando County, FL 20210708-0800 20210708-1700 Sandbags Self Service https://www.wfla.com/news/local-news/tropical-... Hernando County, FL -82.644585 28.505747 51.615680 83067.384236
0 Homosassa Area Recreational Playground 4210 S Grandmarch Avenue, Homosassa, FL 34446 Citrus County, FL 20210708-0800 NaN Sandbags NaN https://www.wfla.com/news/local-news/tropical-... Citrus County, FL -82.568085 28.800981 72.315012 116379.730454
1 Dan’s Clam Stand 7500 W. Gulf to Lake Highway, Crystal River, F... Citrus County, FL 20210708-0800 NaN Sandbags NaN https://www.wfla.com/news/local-news/tropical-... Citrus County, FL -82.559485 28.895449 78.836603 126875.214122
In [54]:
filtered_table = filtered_table[[
    'Distance in Miles',
    'Distance in Meters',
    'Location Name',
    'Normalized Address',
    'Open',
    'Close',
    'Resources',
    'Type',
    'Location County',
    'Organization Name',
    'Source',
]]
filtered_table
Out[54]:
<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>
Distance in Miles Distance in Meters Location Name Normalized Address Open Close Resources Type Location County Organization Name Source
5 2.387880 3842.920458 Northwest Pool 2331 60th Street N, St. Petersburg, FL 33710 20210708-0900 NaN Sandbags NaN Pinellas County, FL City of St. Petersburg, FL https://www.wfla.com/news/local-news/tropical-...
4 4.317530 6948.391605 James "JC" Turner Fields > South Side of Bartl... 643 22nd Avenue S, St. Petersburg, FL 33705 20210708-0900 NaN Sandbags NaN Pinellas County, FL City of St. Petersburg, FL https://www.wfla.com/news/local-news/tropical-...
30 6.914832 11128.343934 Helen Howarth Park 6301 94th Ave, Pinellas Park, FL 33782 NaN NaN Sandbags NaN Pinellas Park, FL Pinellas Park, FL https://wusfnews.wusf.usf.edu/weather/2021-07-...
3 7.309101 11762.857864 Northeast Park > Cardinal Drive Entrance to Ma... 875 62nd Avenue NE, St. Petersburg, FL 33702 20210708-0900 NaN Sandbags NaN Pinellas County, FL City of St. Petersburg, FL https://www.wfla.com/news/local-news/tropical-...
31 8.415505 13543.443271 Pinebrook Park 7202 118th Ave N, Largo, FL 33773 NaN NaN Sandbags NaN Pinellas Park, FL Pinellas Park, FL https://wusfnews.wusf.usf.edu/weather/2021-07-...
28 9.044495 14555.703549 Walsingham Park 2615 102nd Avenue, Seminole, FL 33778 20210708-0700 20210708-1200 Sandbags NaN Pinellas County, FL Pinellas County, FL https://www.wfla.com/news/local-news/tropical-...
12 15.204282 24468.919897 E.G. Simmons Conservation Park 2401 19th Avenue NW, Ruskin, FL 33570 20210708-0800 20210708-1200 Sandbags NaN Hillsborough County, FL Hillsborough County, FL https://www.wfla.com/news/local-news/tropical-...
7 16.078913 25876.502682 Himes Avenue Complex 4501 S. Himes Avenue, Tampa, FL 33611 20210708-0800 20210708-1200 Sandbags NaN Hillsborough County, FL City of Tampa, FL https://www.wfla.com/news/local-news/tropical-...
21 17.981323 28938.133868 Manatee Beach Parking Lot 4000 Gulf Drive, Holmes Beach, FL 34217 20210708-0800 NaN Sandbags Pre Made Manatee County, FL Manatee County, FL https://www.wfla.com/news/local-news/tropical-...
8 19.073430 30695.709894 MacFarlane Park 1700 North MacDill Avenue, Tampa, FL 33607 20210708-0800 20210708-1200 Sandbags NaN Hillsborough County, FL City of Tampa, FL https://www.wfla.com/news/local-news/tropical-...
20 20.429650 32878.335052 GT Bray Park > Parking Lot 5502 33rd Avenue Drive W, Bradenton, FL 34209 20210708-0800 NaN Sandbags Full Service Manatee County, FL Manatee County, FL https://www.wfla.com/news/local-news/tropical-...
29 22.374518 36008.295850 John Chesnut Sr. Park 2200 East Lake Road, Palm Harbor, FL 34685 20210708-0700 20210708-1200 Sandbags NaN Pinellas County, FL Pinellas County, FL https://www.wfla.com/news/local-news/tropical-...
6 22.736540 36590.913542 Al Barnes Park South 2902 N. 32nd Street, Tampa, FL 33605 20210708-0800 20210708-1200 Sandbags NaN Hillsborough County, FL City of Tampa, FL https://www.wfla.com/news/local-news/tropical-...
13 23.221069 37370.687869 Ed Radice Park 14720 Ed Radice Drive, Tampa, FL 33626 20210708-0800 20210708-1200 Sandbags NaN Hillsborough County, FL Hillsborough County, FL https://www.wfla.com/news/local-news/tropical-...
19 24.924909 40112.752656 Public Works Department Stormwater Facility 5511 39th Street E, Bradenton, FL 34203 20210708-0800 NaN Sandbags Self Service Manatee County, FL Manatee County, FL https://www.wfla.com/news/local-news/tropical-...
9 29.593659 47626.377748 Youth Sports Complex 10369 US Highway 301, Temple Terrace, FL 33637 20210708-0800 20210708-1200 Sandbags NaN Hillsborough County, FL City of Temple Terrace https://www.wfla.com/news/local-news/tropical-...
24 32.567594 52412.461865 W. H. Jack Mitchell, Jr., Park 4825 Little Rd, New Port Richey, FL 34655 NaN NaN Sandbags NaN Pasco County, FL Pasco County, FL https://wusfnews.wusf.usf.edu/weather/2021-07-...
26 34.730377 55893.123833 Magnolia Valley Golf Course 7223 Massachusetts Ave, New Port Richey, FL 34653 NaN NaN Sandbags NaN Pasco County, FL Pasco County, FL https://wusfnews.wusf.usf.edu/weather/2021-07-...
11 34.982243 56298.462215 Edward Medard Conservation Park 6140 Turkey Creek Road, Plant City, FL 33567 20210708-0800 20210708-1200 Sandbags NaN Hillsborough County, FL Hillsborough County, FL https://www.wfla.com/news/local-news/tropical-...
32 37.899521 60993.366875 Twin Lakes Park 6700 Clark Road, Sarasota, FL 34241 NaN NaN Sandbags NaN Sarasota County, FL Sarasota County, FL https://www.wfla.com/news/local-news/tropical-...
25 41.972050 67547.466636 Veterans Memoria Park 14333 Hicks Road, Hudson, FL 34669 NaN NaN Sandbags NaN Pasco County, FL Pasco County, FL https://wusfnews.wusf.usf.edu/weather/2021-07-...
27 46.530520 74883.613781 Pasco County Public Works (C-Barn) 30908 Warder Street, San Antonio, FL 33576 NaN NaN Sandbags NaN Pasco County, FL Pasco County, FL https://wusfnews.wusf.usf.edu/weather/2021-07-...
10 51.615680 83067.384236 Linda Pedersen Park 6300 Shoal Line Boulevard, Spring Hill, FL 34607 20210708-0800 20210708-1700 Sandbags Self Service Hernando County, FL Hernando County, FL https://www.wfla.com/news/local-news/tropical-...
0 72.315012 116379.730454 Homosassa Area Recreational Playground 4210 S Grandmarch Avenue, Homosassa, FL 34446 20210708-0800 NaN Sandbags NaN Citrus County, FL Citrus County, FL https://www.wfla.com/news/local-news/tropical-...
1 78.836603 126875.214122 Dan’s Clam Stand 7500 W. Gulf to Lake Highway, Crystal River, F... 20210708-0800 NaN Sandbags NaN Citrus County, FL Citrus County, FL https://www.wfla.com/news/local-news/tropical-...