Skip to content

foofx88/Python-API-Weather_Analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Python API - Finding the Best Vacation Spots


Part 1: Getting data and analyzing relationships

Utilizing Python requests, APIs, and JSON traversals to answer a fundamental question: "What's the weather like as we approach the equator?"
In order to answer this, Python script created to visualize the weather of 500+ cities across the world of varying distance from the equator. Used Python library - citipy and used request to obtain JSON from OpenWeather API

Performed the following on the JSON data:

  • Used np.random to obtain a range of random latitude and longitude to form a lists of coordinates
  • Feed the coordinates into citipy to get a list of city names
  • The city names are then used to get weather data from OpenWeatherMap
  • As there is a limit on the API key, a limiter of 50 is inplace
  • Clean the data by removing a few outliers and export to CSV
  • Plot the data and identify the correlation between Latitude and the required factors - Temperature, Humidity, Cloudiness, Wind Speed
  • Ran linear regression on each relationship and seperate into Northern and Southern Hemisphere

Sample Snippets of Plots:

See part 1's Jupyter Notebook


Part 2: Using the analysis to find the best facation spot

Used the exported CSV to plot on Google Maps and generate a heatmap displaying the humidity for every city

Narrowed down the DataFrame to get the ideal weather condition:

  • A max temperature lower than 80 degrees but higher than 70
  • Wind speed less than 10 mph
  • Zero cloudiness

Feed the ideal locations into Google Places API to find the first hotel within 5000 meters

Pin each hotel on the map

Explore on how it is done on the Jupyter Notebook

Releases

No releases published

Packages

No packages published