Background
Jack loves the PlanMyTrip app. Beta testers love it too. And, as with any new product, they’ve recommended a few changes to take the app to the next level. Specifically, they recommend adding the weather description to the weather data you’ve already retrieved in this module. Then, you'll have the beta testers use input statements to filter the data for their weather preferences, which will be used to identify potential travel destinations and nearby hotels. From the list of potential travel destinations, the beta tester will choose four cities to create a travel itinerary. Finally, using the Google Maps Directions API, you will create a travel route between the four cities as well as a marker layer map.
What You're Creating
This new assignment consists of three technical analyses. You will submit the following deliverables:
- Deliverable 1: Retrieve Weather Data
- Deliverable 2: Create a Customer Travel Destinations Map
- Deliverable 3: Create a Travel Itinerary Map
Files
Use the following links to download the Challenge starter codes.
Download Deliverable 2 starter code(Links to an external site.)
Download Deliverable 3 starter code(Links to an external site.)
Deliverable 1: Retrieve Weather Data (25 points)
Deliverable 1 Instructions
Generate a set of 2,000 random latitudes and longitudes, retrieve the nearest city, and perform an API call with the OpenWeatherMap. In addition to the city weather data you gathered in this module, use your API skills to retrieve the current weather description for each city. Then, create a new DataFrame containing the updated weather data.
REWINDFor this deliverable, you’ve already done the following in this module:
Create a folder called Weather_Database.
Create a new Jupyter Notebook file to retrieve the weather data, and name itWeather_Database.ipynb
.
Create a new set of 2,000 random latitudes and longitudes.
Get the nearest city using thecitipy
module.
Perform an API call with the OpenWeatherMap.
Retrieve the following information from the API call:
- Latitude and longitude
- Maximum temperature
- Percent humidity
- Percent cloudiness
- Wind speed
- Weather description (for example, clouds, fog, light rain, clear sky)
Add the data to a new DataFrame.
- Before exporting your new DataFrame as a CSV file, take a moment to confirm that it looks similar to the image below:
Export the DataFrame as a CSV file, and save it asWeatherPy_Database.csv
in the Weather_Database folder.
Deliverable 1 Requirements
You will earn a perfect score for Deliverable 1 by completing all requirements below:
Retrieve all of the following information from the API call:(15 pt)
- Latitude and longitude
- Maximum temperature
- Percent humidity
- Percent cloudiness
- Wind speed
- Weather description (for example, clouds, fog, light rain, clear sky)
Add the weather data to a new DataFrame(5 pt)
Export the DataFrame asWeatherPy_Database.csv
into the Weather_Database folder(5 pt)
Be sure to double-check that you have the following in the Weather_Database folder:
- The
Weather_Database.ipynb
file
- The
WeatherPy_Database.csv
file
Deliverable 2: Create a Customer Travel Destinations Map (35 points)
Deliverable 2 Instructions
Use input statements to retrieve customer weather preferences, then use those preferences to identify potential travel destinations and nearby hotels. Then, show those destinations on a marker layer map with pop-up markers.
REWINDFor this deliverable, you’ve already done the following in this module:
Create a folder called Vacation_Search.
Download theVacation_Search_starter_code.ipynb
file into your Vacation_Search folder, and rename itVacation_Search.ipynb
.
In theVacation_Search.ipynb
file, make sure the dependencies and API keys are imported correctly.
Use the instructions below to add code where indicated by the numbered-step comments in the starter code file.
In Step 1, import theWeatherPy_Database.csv
file from your Weather_Database folder from Deliverable 1 as a DataFrame.
In Step 2, write two input statements that prompt the user to enter their minimum and maximum temperature criteria for their vacation.
In Step 3, use theloc
method to filter thecity_data_df
DataFrame for temperature criteria collected in Step 2, then create a new DataFrame.
In Steps 4a-b, determine if there are any empty rows, then drop them if necessary and create a new DataFrame.
In Steps 5a-b, use the provided code to create a new DataFrame,hotel_df
, that will hold the hotel names from the hotel search in Steps 6a-6f.
In Step 6a, we have supplied the search parameters, which are the same as in this module, that you’ll need to use to search for a hotel for each city in Steps 6b-f.
In Steps 6b-f, iterate through thehotel_df
DataFrame, retrieve the latitude and longitude of each city to find the nearest hotel based on the search parameters from Step 6a, then add the hotel name to thehotel_df
DataFrame. If a hotel isn't found, skip to the next city.
In Step 7, drop any rows in thehotel_df
DataFrame where a hotel name is not found.
- Before exporting your DataFrame as a CSV, take a moment to confirm that your hotel_df DataFrame looks similar to the image below.
In Steps 8a-b, create an output file to store thehotel_df
DataFrame asWeatherPy_vacation.csv
in the Vacation_Search folder.
In Step 9, add the city name, the country code, the weather description, and the maximum temperature for the city to theinfo_box_template
format template we have provided.
In Step 10a, use the provided list comprehension code to retrieve the city data from each row, which will then be added to the formatting template and saved in thehotel_info
list.
In Step 10b, use the provided code snippet to retrieve the latitude and longitude from each row and store them in a new DataFrame.
In Steps 11a-b, refactor your previous marker layer map code to create a marker layer map that will have pop-up markers for each city on the map.
Take a screenshot of your map and save it to the Vacation_Search folder asWeatherPy_vacation_map.png
.
- The marker layer map with a pop-up marker for each city should look similar to the following image:
Deliverable 2 Requirements
You will earn a perfect score for Deliverable 2 by completing all requirements below:
- Input statements are written to prompt the customer for their minimum and maximum temperature preferences.(5 pt)
- A new DataFrame is created based on the minimum and maximum temperature, and empty rows are dropped.(5 pt)
- The hotel name is retrieved and added to the DataFrame, and the rows that don’t have a hotel name are dropped.(10 pt)
- The DataFrame is exported as a CSV file into the Vacation_Search folder and is saved as
WeatherPy_vacation.csv
.(5 pt)
- A marker layer map with pop-up markers for the cities in the vacation DataFrame is created, and it is uploaded as a PNG. Each marker has the following information:(5 pt)
- Hotel name
- City
- Country
- Current weather description with the maximum temperature
- The marker layer map is saved and uploaded to the Vacation_Search folder as
WeatherPy_vacation_map.png
.(5 pt)
Be sure to double-check that you have the following in the Vacation_Search folder:
- The
Vacation_Search.ipynb
file
- The
WeatherPy_vacation.csv
file
- The
WeatherPy_vacation_map.png
image
Deliverable 3: Create a Travel Itinerary Map (40 points)
Deliverable 3 Instructions
Use the Google Directions API to create a travel itinerary that shows the route between four cities chosen from the customer’s possible travel destinations. Then, create a marker layer map with a pop-up marker for each city on the itinerary.
REWINDFor this deliverable, you’ve already done the following in this module:
Enable the "Directions API" in your Google account for your API key.
- On the Google Cloud Platform, select "APIs & Services" from the left-hand side
- In the Search field, type "Directions".
- Click "Enable" to activate the Directions API.
Create a folder called Vacation_Itinerary.
Download theVacation_Itinerary_starter_code.ipynb
file into your Vacation_Itinerary folder and rename itVacation_Itinerary.ipynb
.
In theVacation_Itinerary.ipynb
file, make sure the dependencies and API keys are imported.
Use the instructions below to add code where indicated by the numbered-step comments in the starter code file.
In Step 1, import theWeatherPy_vacation.csv
file from your Vacation_Search folder from Deliverable 2 as a DataFrame.
In Steps 2-4, copy or refactor the code from Steps 11a-b of Deliverable 2 to create a marker layer map of the vacation search results.
From the vacation search map,choose four citiesthat a customer might want to visit. They should be close together and in the same country.
- You may have to refine your search with different weather criteria to get cities that are close together.
In Step 5, use the variables we have provided and theloc
method to create separate DataFrames for each city on the travel route.
Hint:You will start and end the route in the same city, so thevacation_start
andvacation_end
DataFrames will be the same city.
- In Step 6, use the
to_numpy()
function and list indexing to write code to retrieve the latitude-longitude pairs as tuples from each city DataFrame.
If you’d like a hint on using theto_numpy()
function with list indexing, that’s totally okay. If not, that’s great too. You can always revisit this later if you change your mind.
HINT
In Step 7, use thegmaps documentation(Links to an external site.)to create a directions layer map using the variables from Step 6, where the starting and ending city are the same city, thewaypoints
are the three other cities, and thetravel_mode
is either"DRIVING"
,"BICYCLING"
, or"WALKING"
.
Take a screenshot of your map from Step 7 and save it to the Vacation_Itinerary folder asWeatherPy_travel_map.png
.
- The directions layer map should look similar to the following image:
- In Step 8, use the provided
concat()
function code snippet to combine the four separate city DataFrames into one DataFrame.
If you’d like a hint on combining DataFrames into one DataFrame using theconcat()
function, that’s totally okay. If not, that’s great too. You can always revisit this later if you change your mind.
HINT
In Steps 9-11, refactor the code from Steps 2-4 to create a new marker layer map of the cities on the travel route.
Take a screenshot of your map and save it to the Vacation_Itinerary folder asWeatherPy_travel_map_markers.png
.
- The marker layer map with a pop-up marker for each city should look similar to the following image:
Deliverable 3 Requirements
You will earn a perfect score for Deliverable 3 by completing all requirements below:
- Four DataFrames are created, one for each city on the itinerary.(10 pt)
- The latitude and longitude pairs for each of the four cities are retrieved.(5 pt)
- A directions layer map between the cities and the travel map is created and uploaded as
WeatherPy_travel_map.png
.(10 pt)
- A DataFrame that contains thefourcities on the itinerary is created.(10 pt)
- A marker layer map with a pop-up marker for the cities on the itinerary is created, and it is uploaded as
WeatherPy_travel_map_markers.png
. Each marker has the following information:(5 pt)
- Hotel name
- City
- Country
- Current weather description with the maximum temperature
Be sure to double-check that you have the following in the Vacation_Itinerary folder:
- The
Vacation_Itinerary.ipynb
file
- The
WeatherPy_travel_map.png
image
- The
WeatherPy_travel_map_markers.png
image
Submission
Once you’re ready to submit, make sure to check your work against the rubric to ensure you are meeting the requirements for this Challenge one final time. It’s easy to overlook items when you’re in the zone!
As a reminder, the deliverables for this Challenge are as follows:
- Deliverable 1: Retrieve Weather Data
- Deliverable 2: Create a Customer Travel Destinations Map
- Deliverable 3: Create a Travel Itinerary Map
Upload the following to your WeatherPy GitHub repository:
The Weather_Database folder with the following:
- The
Weather_Database.ipynb
file
- The
WeatherPy_Database.csv
file
The Vacation_Search folder with the following:
- The
Vacation_Search.ipynb
file
- The
WeatherPy_vacation.csv
file
- The
WeatherPy_vacation_map.png
image
The Vacation_Itinerary folder with the following:
- The
Vacation_Itinerary.ipynb
file
- The
WeatherPy_travel_map.png
image
- The
WeatherPy_travel_map_markers.png
image
A README.md that describes the purpose of the repository. Although there is no graded written analysis for this challenge, it is encouraged and good practice to add a brief description of your project.
IMPORTANTDo not include yourconfig.py
file in your submission.
If you’d like a hint on how to not include theconfig.py
file when adding your files to your GitHub repository, that’s totally okay. If not, that’s great too. You can always revisit this later if you change your mind.
HINTTo submit your challenge assignment in Canvas, click Submit, then provide the URL of your WeatherPy GitHub repository for grading. Comments are disabled for graded submissions in BootCampSpot. If you have questions about your feedback, please notify your instructional staff or the Student Success Manager. If you would like to resubmit your work for an improved grade, you can use theRe-Submit Assignmentbutton to upload new links. You may resubmit up to 3 times for a total of 4 submissions.
IMPORTANTOnce you receive feedback on your Challenge, make any suggested updates or adjustments to your work. Then, add this week’s Challenge to your professional portfolio.
NOTEYou are allowed to miss up to two Challenge assignments and still earn your certificate. If you complete all Challenge assignments, your lowest two grades will be dropped. If you wish to skip this assignment, click Submit then indicate you are skipping by typing “I choose to skip this assignment” in the text box.
Rubric
Module-6 RubricModule-6 Rubric
Criteria |
Ratings |
Pts |
---|
This criterion is linked to a learning outcomeDeliverable 1: Retrieve Weather Data |
25to >21.0PtsMastery✓The deliverable fulfills the “Emerging” criteria AND the following: ✓All the weather data is added to a new DataFrame. ✓The DataFrame is exported and saved as a CSV. |
21to >18.0PtsApproaching Mastery✓The deliverable fulfills the “Emerging” criteria AND the following: ✓All the weather data is added to a new DataFrame. ✓Code is written to export the DataFrame as a CSV, but there is an error to save it. |
18to >15.0PtsProgressing✓The deliverable fulfills the “Emerging” criteria AND the following: ✓Most of the weather data is added to a new DataFrame. |
15to >0.0PtsEmerging✓All of the required data from the API is retrieved. |
0PtsIncomplete |
|
25pts
|
This criterion is linked to a learning outcomeDeliverable 2: Create a Customer Travel Destinations Map |
35to >32.0PtsMastery✓Input statements are written to get the minimum and maximum temperature. ✓A new DataFrame is created based on the weather criteria, and empty rows are dropped. ✓The hotel name is added to the DataFrame, and the empty rows are dropped. ✓The DataFrame is exported and saved as a CSV file. ✓A marker layer map is created with a pop-up marker for each city that has all the correct data. ✓The marker layer map is saved as a PNG |
32to >27.0PtsApproaching Mastery✓Input statements are written to get the minimum and maximum temperature. ✓A new DataFrame is created based on the weather criteria, and empty rows are dropped. ✓The hotel name is added to the DataFrame, and the empty rows are dropped. ✓The DataFrame is exported and saved as a CSV file. ✓A marker layer map is created with a pop-up marker for each city, but some cities don’t have all the data. ✓The marker layer map is saved as a PNG |
27to >24.0PtsProgressing✓Input statements are written to get the minimum and maximum temperature. ✓A new DataFrame is created based on the weather criteria, and empty rows are dropped. ✓The hotel name is added to the DataFrame, but the empty rows are not dropped. ✓The DataFrame is exported and saved as a CSV file. ✓A marker layer map is created with a pop-up marker for each city, but some cities don’t have all the data. ✓The marker layer map is saved as a PNG |
24to >0.0PtsEmerging✓Input statements are written to get the minimum and maximum temperature. ✓A new DataFrame is created based on the weather criteria, but the empty rows are not dropped. ✓The hotel name is added to the DataFrame, but the empty rows are not dropped. ✓The DataFrame is exported and saved as a CSV file. ✓A marker layer map is created with a pop-up marker for each city, but some cities don’t have all the data. ✓The marker layer map is saved as a PNG |
0PtsIncomplete |
|
35pts
|
This criterion is linked to a learning outcomeDeliverable 3: Create a Travel Itinerary Map |
40to >36.0PtsMastery✓Four DataFrames are created, one for each city in the itinerary. ✓The latitude and longitude pairs for each city are retrieved to create the directions layer map. ✓A directions layer map between the cities and the travel map is uploaded as a PNG. ✓A DataFrame that contains the four cities on the itinerary is created. ✓A marker layer map with a pop-up marker for the cities in the itinerary is created, and is uploaded as a PNG. |
36to >34.0PtsApproaching Mastery✓Four DataFrames are created, one for each city in the itinerary. ✓The latitude and longitude pairs for each city are retrieved to create the directions layer map. ✓There is a directions layer map between THREE of the FOUR cities, and the travel map is uploaded as a PNG. ✓A DataFrame that contains the four cities on the itinerary is created. ✓A marker layer map with a pop-up marker for the cities in the itinerary is created, and is uploaded as a PNG. |
34to >31.0PtsProgressing✓Four DataFrames are created, one for each city in the itinerary. ✓The latitude and longitude pairs for each city are retrieved to create the directions layer map. ✓There is a directions layer map between TWO of the FOUR cities, and the travel map is uploaded as a PNG. ✓A DataFrame that contains the four cities on the itinerary is created. ✓A marker layer map with a pop-up marker for the cities in the itinerary is created, and is uploaded as a PNG. |
31to >0.0PtsEmerging✓Four DataFrames are created, one for each city in the itinerary. ✓Code is written to retrieve the latitude and longitude pairs for each of the four cities. ✓Code is written but a directions layer map isn’t created between the cities. ✓A DataFrame that contains the four cities on the itinerary is created. ✓A marker layer map with a pop-up marker for the cities in the itinerary is created, and is uploaded as a PNG. |
0PtsIncomplete |
|
40pts
|
Total points:100 |
6.5.4: Map Vacation Criteria" style="float: left;">
PreviousModule 6 Career Connection" style="float: right;">
Next© 2020 - 2021 Trilogy Education Services, a 2U, Inc. brand. All Rights Reserved.