<jupyter_start><jupyter_text>Create a new Jupyter Notebook file and name it Vacation_Search.ipynb.<jupyter_code># Import the dependencies.
import pandas as pd
import matplotlib.pyplot as plt
import numpy as np
from scipy import stats<jupyter_output><empty_output><jupyter_text>Import the WeatherPy_vacation.csv file from Part 1 as a new DataFrame.<jupyter_code># Store the CSV you saved created in part one into a DataFrame.
city_data_df = pd.read_csv("weather_data/WeatherPy_challenge.csv")
city_data_df.head()<jupyter_output><empty_output><jupyter_text>Filter the DataFrame for minimum and maximum temperature preferences, and if the rain or snow accumulation is 0 inches or not using conditional statements. Do the following:<jupyter_code>cols = city_data_df.columns.tolist()
cols
# Prompt the customer for the minimum temperature preference.
min_temp = float(input("What is the minimum temperature you would like for your trip? "))
# Prompt the customer for the maximum temperature preference. 
max_temp = float(input("What is the maximum temperature you would like for your trip? "))
# Prompt the customer to answer if he or she would like it to be raining or not.
rain = str(input('Do you want it to be raining? (yes/no)\n'))
# Prompt the customer to answer if he or she would like it to be snowing or not
snow = str(input('Do you want it to be snowing? (yes/no)\n')) 
# Filter the dataset to find the cities that fit the criteria.
for index, row in city_data_df.iterrows():
    if rain == "no":
        rain_inches = city_data_df["Rain inches (last 3 hours)"] == 0
    else:
        rain_inches = city_data_df["Rain inches (last 3 hours)"] != 0
    if snow == "no":
        snow_inches = city_data_df["Snow inches (last 3 hours)"] == 0
    else:
        snow_inches = city_data_df["Snow inches (last 3 hours)"] != 0
# Filter the dataset to find the cities that fit the criteria.

preferred_cities_df = city_data_df.loc[(city_data_df["Rain inches (last 3 hours)"] != rain_inches) &
                                       (city_data_df["Snow inches (last 3 hours)"] != snow_inches) &
                                       (city_data_df["Max Temp"] <= max_temp) & \
                                       (city_data_df["Max Temp"] >= min_temp)]
                                       
preferred_cities_df.head(10)<jupyter_output><empty_output><jupyter_text>Add the cities to a marker layer map with a pop-up marker for each city that includes:<jupyter_code># Create DataFrame called hotel_df to store hotel names along with city, country, max temp, and coordinates.
hotel_df = preferred_cities_df[["City", "Country", "Max Temp", "Current Description", "Lat", "Lng"]].copy()
hotel_df["Hotel Name"] = ""
hotel_df.head(10)
# Dependencies and Setup
import requests
import gmaps

# Import API key
from config import g_key
# Set parameters to search for a hotel.
params = {
    "radius": 5000,
    "type": "lodging",
    "key": g_key
}
# Iterate through the DataFrame.
for index, row in hotel_df.iterrows():
    # Get the latitude and longitude.
    lat = row["Lat"]
    lng = row["Lng"]

    # Add the latitude and longitude to the params dictionary as values to the location key.
    params["location"] = f"{lat},{lng}"

    # Use the search term: "lodging" and our latitude and longitude.
    base_url = "https://maps.googleapis.com/maps/api/place/nearbysearch/json"
    # Make request and get the JSON data from the search.
    hotels = requests.get(base_url, params=params).json()
    # Grab the first hotel from the results and store the name.
    try:
        hotel_df.loc[index, "Hotel Name"] = hotels["results"][0]["name"]
    except (IndexError):
        print("Hotel not found... skipping.")
info_box_template = """
<dl>
<dt>Hotel Name</dt><dd>{Hotel Name}</dd>
<dt>City</dt><dd>{City}</dd>
<dt>Country</dt><dd>{Country}</dd>
<dt>Current Description</dt><dd>{Current Description}</dd>
<dt>Max Temp</dt><dd>{Max Temp} °F</dd>
</dl>
"""
# Store the DataFrame Row.
hotel_info = [info_box_template.format(**row) for index, row in hotel_df.iterrows()]
# Add a heatmap of temperature for the vacation spots and a pop-up marker for each city.
locations = hotel_df[["Lat", "Lng"]]
max_temp = hotel_df["Max Temp"]
fig = gmaps.figure(center=(30.0, 31.0), zoom_level=1.5)
heat_layer = gmaps.heatmap_layer(locations, weights=max_temp,dissipating=False,
             max_intensity=300, point_radius=4)
marker_layer = gmaps.marker_layer(locations, info_box_content=hotel_info)
fig.add_layer(heat_layer)
fig.add_layer(marker_layer)

# Call the figure to plot the data.
fig<jupyter_output><empty_output><jupyter_text>Save and upload the new DataFrame as WeatherPy_vacation.csv.<jupyter_code># Create the output file (CSV).
output_data_file = "weather_data/WeatherPy_vacation.csv"
# Export the City_Data into a CSV.
hotel_df.to_csv(output_data_file, index_label="City_ID")<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.11031664964249234, 'fraction_numerical': 0.006741573033707865, 'mean_word_length': 4.105318039624609, 'pattern_counts': {'":': 5, '<': 44, '<?xml version=': 0, '>': 44, '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': '514206', 'license': 'MIT', 'n_tokens_mistral': 1606, 'n_tokens_neox': 1537, 'n_words': 503, 'path': 'Vacation_Search.ipynb', 'repo_name': 'angel-2022cal/World_Weather_Analysis', 'size': '4895'}