What's the Weather Like?
This activity is broken down into two parts, WeatherPy and VacationPy.
-
WeatherPy: A Python script is created to collect the weather details of over 500 cities of varying distances from the equator, using citipy python library and OpenWeatherMap API.
-
VacationPy: The final csv cities.csv created at the end of the WeatherPy analysis is used as an input here.
-
A Cities list is generated using random sets of latitude and longitude combinations, using the python library citipy.
-
A weather check is performed on each city in the list using a series of successive OpenWeatherMap API calls.
-
In order to limit API call rate, the API calls are made in sets of 50 cities with a break of 5 seconds between each set. Also the API calls are stopped after the data for 500 cities are collected.
-
The weather data collected for the 500 cities are then held in the dataframe weather_data.
-
This data is also stored in the csv file python_api_challenge\output_data\WeatherPy\cities.csv
-
The following graphs are created for Cities, Northern and Southern Hemispheres and stored as png images in the folder python_api_challenge\output_data\WeatherPy\
- Latitude Vs. Max Temp
- Latitude Vs. Humidity
- Latitude Vs. Cloudiness
- Latitude Vs. Wind Speed
-
The analysis of the plots above can be found in the Jupyter notebook as required.
-
The Jupyter notebook also contains the observable trends explained at the bottom.
-
The csv file (cities.csv) from WeatherPy is the input for VacationPy.
-
The dataframe cities_weather is created by reading the data from cities.csv file. This dataframe is then used for all analysis.
-
Humidity Heatmap: The latitudes and longitudes of the 500+ cities in the cities_weather dataframe are used as locations and Humidity as the weight to plot this heatmap.
-
The dataframe cities_weather is then narrowed down to find the ideal weather condition for a vacation. The conditions used are
- The max temperature lower than 80 but higher than 70F
- Wind Speed less than 10mph
- Zero cloudiness
-
The cities filtered above are stored in the dataframe hotel_df.
-
This dataframe is then updated to store the hotel names. The Google Places APIis used to find the first hotel located within 5,000 meters of the coordinates of each city.
-
These hotels are then plotted on the Humidity Heatmap created earlier with clickable pins displaying City, Country and Hotel Name.
-
the images of the heatmaps can be found in python_api_challenge\output_data\VacationPy\Heatmap_humidity.png and python_api_challenge\output_data\VacationPy\Heatmap_humidity_hotels.png.
-
Jupyter Notebook - python_api_challenge\WeatherPy.ipynb
-
Output csv file - python_api_challenge\output_data\WeatherPy\cities.csv
-
12 png images of the scatter plots in python_api_challenge\output_data\WeatherPy\
-
Jupyter Notebook - python_api_challenge\VacationPy.ipynb
-
Humidity Heatmap - python_api_challenge\output_data\VacationPy\Heatmap_humidity.png
-
Humidity Heatmap with hotel pins - python_api_challenge\output_data\VacationPy\Heatmap_humidity_hotels.png