<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>weather_file="../output_data/cities.csv"
weather_df=pd.read_csv(weather_file)
del weather_df["Unnamed: 0"]
weather_df
temp=list(weather_df["Max Temp (F)"])
humidity=list(weather_df["Humidity (%)"])
cloudiness=list(weather_df["Cloudiness (%)"])
wind=list(weather_df["Wind Speed (mph)"])<jupyter_output><empty_output><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>#access gmaps with key
gmaps.configure(api_key=g_key)
fig=gmaps.figure(map_type="HYBRID")
heatmap_layer=gmaps.heatmap_layer(weather_df[["Latitude","Longitude"]], 
                               weights=weather_df["Humidity (%)"], 
                               max_intensity=76, 
                               point_radius=20)


heatmap_layer.max_intensity=100
heatmap_layer.point_radius=10

fig.add_layer(heatmap_layer)
fig<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>#the nulls values were all drop in weatherPy before saving the datafram in the csv

min_temp=int(input("Enter the Minimum Temperature in Fahrenheit between 0 and 95: "))
max_temp=int(input("Enter the Maximum Temperature in Fahrenheit between 0 and 95: "))
min_humidity=float(input("Enter the Minimum Humidity percentage between 0 and 100: "))
max_humidity=float(input("Enter the Maximum Humidity percentage between 0 and 100: "))
min_cloudiness=float(input("Enter the Minimum Cloudiness percentage between 0 and 100: "))
max_cloudiness=float(input("Enter the Maximum Cloudiness percentage between 0 and 100: "))
min_wind=float(input("Enter the Minimum Wind Speed (mph) between 0 and 100: "))
max_wind=float(input("Enter the Maximum Wind Speed (mph) between 0 and 100: "))

weather_conditions_df=weather_df[(weather_df["Max Temp (F)"]>min_temp)&(weather_df["Max Temp (F)"]<max_temp)&
                                       (weather_df["Humidity (%)"]>min_humidity)&(weather_df["Humidity (%)"]<max_humidity)&
                                       (weather_df["Cloudiness (%)"]>min_cloudiness)&(weather_df["Cloudiness (%)"]<max_cloudiness)&
                                       (weather_df["Wind Speed (mph)"]>min_wind)&(weather_df["Wind Speed (mph)"]<max_wind)]
                                       
weather_conditions_df<jupyter_output>Enter the Minimum Temperature in Fahrenheit between 0 and 95: 78
Enter the Maximum Temperature in Fahrenheit between 0 and 95: 85
Enter the Minimum Humidity percentage between 0 and 100: 60
Enter the Maximum Humidity percentage between 0 and 100: 80
Enter the Minimum Cloudiness percentage between 0 and 100: 0
Enter the Maximum Cloudiness percentage between 0 and 100: 20
Enter the Minimum Wind Speed (mph) between 0 and 100: 0
Enter the Maximum Wind Speed (mph) between 0 and 100: 20<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>hotel_df=weather_conditions_df.copy()
hotel_df["Hotel Name"]=""
hotel_df
base_url="https://maps.googleapis.com/maps/api/place/nearbysearch/json?parameters"
params={"key":g_key,"radius":"5000", "keyword":"Hotel"}

for index, row in hotel_df.iterrows():
    latitude=row["Latitude"]
    longitude=row["Longitude"]
    coordinates=f"{latitude}, {longitude}"
    params["location"]=coordinates

    data=requests.get(base_url, params=params).json()
    
    try:
        hotel_df.loc[index,"Hotel Name"]=data["results"][0]["name"]
        city=row["City"]
    except:
        print(f"No hotels found in {city}")
hotel_df
# 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 hotel_df.iterrows()]
locations = hotel_df[["Latitude", "Longitude"]]

#add marker
marker_layer = gmaps.marker_layer(locations, info_box_content=hotel_info)
fig = gmaps.figure()
fig.add_layer(marker_layer)

# Display figure
fig<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.1090727816550349, 'fraction_numerical': 0.018544366899302094, 'mean_word_length': 4.798843930635838, 'pattern_counts': {'":': 3, '<': 38, '<?xml version=': 0, '>': 38, 'https://': 1, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '5', 'dir': 'jupyter-structured-clean-dedup', 'id': '122942', 'license': 'ADSL', 'n_tokens_mistral': 1680, 'n_tokens_neox': 1496, 'n_words': 464, 'path': 'starter_code/VacationPy.ipynb', 'repo_name': 'angelasivirich/Global-Weather-Analysis', 'size': '5015'}