Skip to content
This repository has been archived by the owner on Aug 7, 2022. It is now read-only.

Used Jupyter Notebook, Pandas, and Matplotlib to visualize regression analysis on data extracted from Open Weather API. Used Google Maps API to visualize differences in humidity between cities, and to show hotels for locations experiencing great weather.

Notifications You must be signed in to change notification settings

david-fried/Identifying-Vacation-Spots

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Analysis of Weather using APIs

General Overview

Using WeatherPy.ipynb, extracts data from Open Weather Map API and creates a CSV file of weather information for several hundred cities throughout the world. Analyzes the influence of latitude on weather using regression; visualizes results with Matplotlib. Using VacationPy.ipynb, creates a heatmap that visualizes differences in humidity between cities; overlayes the map with hotels from locations experiencing great weather.

WeatherPy.ipynb

Weather data was extracted from openweathermap.org. Data from each API request were converted to a json object. Below are the general project steps.

  1. Generated a list of cities: Looped through a list of over 600 latitude-longitude pairs to find the nearest city using Citipy.

  2. Extracted weather information for each city using a series of successive API calls; saved weather data for each city in lists.

  3. Created a Pandas dataframe from the lists and exported the dataframe to a CSV file ("cities.csv").

  4. Used regression to analyze the influence of latitude on weather. Created visualizations with Matplotlib.

       def regression(x, y, x_label, y_label, hemisphere):
           title = f'{hemisphere} Hemisphere:\nRegressing {y_label} on {x_label}'
           (slope, intercept, rvalue, pvalue, stderr) = linregress(x, y)
           regress_values = x * slope + intercept
           line_eq = "y = " + str(round(slope,2)) + "x + " + str(round(intercept,2))
           plt.scatter(x, y)
           plt.plot(x,regress_values,"r-")
           plt.xlabel(x_label)
           plt.ylabel(y_label)
           plt.title(title)
           title = title.replace(':\n', '_').replace(' ', '_')
           plt.savefig(f'output_data/{title}.png')
           plt.show()
           print(line_eq)
           print()
           print(f"r = {pearsonr(x, y)[0]:.2f}, p = {pearsonr(x, y)[1]:.4f}, r_squared = {rvalue**2:.2f}")
           print()
    

Example of Regression Output

Example of Regression Interpretation

VacationPy.ipynb

Created a heatmap with Google Maps Platform and the CSV file generated from WeatherPy.ipynb ("cities.csv"). The heatmap visualizes differences in humidity between cities. Identifies cities experiencing great weather; for each of these cities, finds the nearest hotel within a 5,000 meter radius and adds the hotel name to the heatmap.

Hotel Map

About

Used Jupyter Notebook, Pandas, and Matplotlib to visualize regression analysis on data extracted from Open Weather API. Used Google Maps API to visualize differences in humidity between cities, and to show hotels for locations experiencing great weather.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published