<jupyter_start><jupyter_text>VacationPy---- Note* Instructions have been included for each segment. You do not have to follow them exactly, but they are included to help you think through the steps.<jupyter_code># Dependencies and Setup
import matplotlib.pyplot as plt
import pandas as pd
import numpy as np
import requests
import gmaps
import os

# Import API key
from api_keys import g_key<jupyter_output><empty_output><jupyter_text>Store Part I results into DataFrame* Load the csv exported in Part I to a DataFrame<jupyter_code>df = pd.read_csv('../output_data/RawData.csv')

print(f'There are now {len(df)} cities in the dataframe')
df.head()<jupyter_output>There are now 552 cities in the dataframe<jupyter_text>Humidity Heatmap* Configure gmaps.* Use the Lat and Lng as locations and Humidity as the weight.* Add Heatmap layer to map.<jupyter_code># Note: NaN values were handled in export of csv data already but may as well do it again:
df = df.dropna()

# Store latitude and longitude in locations as float
locations = df[["Latitude", "Longitude"]].astype(float)

# Convert to float
humidity = df["Humidity"].astype(float)

print(f'There are {len(locations)} locations')
print(f'There are {len(humidity)} humidity rows')
assert (len(locations) == len(humidity)), "Locations and humidity do not have the same number of rows!"
# Value verification - any rows outside of lat/long coordinates?
print(f'Min Lat: {df["Latitude"].min()}')
print(f'Max Lat: {df["Latitude"].max()}')

print(f'Min Lng: {df["Longitude"].min()}')
print(f'Max Lng: {df["Longitude"].max()}')
# Configure gmaps
gmaps.configure(api_key=g_key)

# Plot Heatmap
fig = gmaps.figure()
heatmap_layer = gmaps.heatmap_layer(locations)

# For max intensity in the heat map, try setting it to the highest humidity found in the data set.
# Must be float
intensity = df["Humidity"].max().astype(float)

# Create heat layer
heat_layer = gmaps.heatmap_layer(
    locations, 
    weights=humidity, 
    dissipating=False, 
    max_intensity=intensity
)

# Add layer
fig.add_layer(heat_layer)

# Display figure
fig



heat_layer = gmaps.heatmap_layer(
    locations, 
    weights=humidity, 
    dissipating=False, 
    max_intensity=intensity,
    point_radius=1
)<jupyter_output><empty_output><jupyter_text>Create new DataFrame fitting weather criteria* Narrow down the cities to fit weather conditions.* Drop any rows will null values.<jupyter_code>import gmaps.datasets
df = gmaps.datasets.load_dataset_as_df('earthquakes')
# dataframe with columns ('latitude', 'longitude', 'magnitude')

fig = gmaps.figure()
heatmap_layer = gmaps.heatmap_layer(
    df[['latitude', 'longitude']], weights=df['magnitude'],
    max_intensity=99, point_radius=3.0
)
fig.add_layer(heatmap_layer)
fig<jupyter_output><empty_output><jupyter_text>Hotel Map* Store into variable named `hotel_df`.* Add a "Hotel Name" column to the DataFrame.* Set parameters to search for hotels with 5000 meters.* Hit the Google Places API for each city's coordinates.* Store the first Hotel result into the DataFrame.* Plot markers on top of the heatmap.<jupyter_code># NOTE: Do not change any of the code in this cell

# Using the template add the hotel marks to the heatmap
info_box_template = """
<dl>
<dt>Name</dt><dd>{Hotel Name}</dd>
<dt>City</dt><dd>{City}</dd>
<dt>Country</dt><dd>{Country}</dd>
</dl>
"""
# Store the DataFrame Row
# NOTE: be sure to update with your DataFrame name
hotel_info = [info_box_template.format(**row) for index, row in narrowed_city_df.iterrows()]
locations = hotel_df[["Lat", "Lng"]]
# Add marker layer ontop of heat map


# Display Map<jupyter_output><empty_output>
StarcoderdataJupyterStructuredCleanDedup