Skip to content

Demonstrates my ability to use Python in Jupyter Notebook to pull and analyze data from an open-source API.

Notifications You must be signed in to change notification settings

Sharkb8t/python-api-challenge

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 

Repository files navigation

Weather & Vacation Analysis with Python


🗺️ Project Overview:

This project leverages Python, Jupyter Notebooks, and API requests to analyze weather data and recommend vacation destinations based on ideal weather conditions. The project is divided into two parts:

  • WeatherPy: Uses OpenWeatherMap API to gather weather data for over 500 randomly selected cities worldwide and analyzes relationships between weather variables and latitude.

  • VacationPy: Uses Geoapify API to find ideal vacation spots based on selected weather conditions and locates nearby hotels.


📂 Files Included

1️⃣ Jupyter Notebook Files

  • WeatherPy.ipynb → Starter file that will help pull weather data for cities around the world to help filter and collect necessary parameters for filtering in the second Jupyter Notebook file.

  • VacationPy.ipynb → Secondary file that will help narrow down generated list of cities to meet personal parameters of humidity, cloudiness, wind speed, and max temperature. This file will also narrow down the list of prime locations to include only ones with hotels nearby.

2️⃣ Output Files (Located in output_data/ Folder)

  • City Latitude vs. Cloudiness.png → Will be generated by WeatherPy Jupyter Notebook file.

  • City Latitude vs. Humidity.png → Will be generated by WeatherPy Jupyter Notebook file.

  • City Latitude vs. Max Temperature.png → Will be generated by WeatherPy Jupyter Notebook file.

  • City Latitude vs. Wind Speed.png → Will be generated by WeatherPy Jupyter Notebook file.

  • NH Cloudiness vs. Latitude.png → Will be generated by WeatherPy Jupyter Notebook file.

  • NH Humidity vs. Latitude.png → Will be generated by WeatherPy Jupyter Notebook file.

  • NH Temperature vs. Latitude.png → Will be generated by WeatherPy Jupyter Notebook file.

  • NH Wind Speed vs. Latitude.png → Will be generated by WeatherPy Jupyter Notebook file.

  • SH Cloudiness vs. Latitude.png → Will be generated by WeatherPy Jupyter Notebook file.

  • SH Humidity vs. Latitude.png → Will be generated by WeatherPy Jupyter Notebook file.

  • SH Temperature vs. Latitude.png → Will be generated by WeatherPy Jupyter Notebook file.

  • SH Wind Speed vs. Latitude.png → Will be generated by WeatherPy Jupyter Notebook file.

  • cities.csv → Will be generated by WeatherPy Jupyter Notebook file.

📂 Repository Structure

python-api-challenge/
│-- PyWeather/
│   │-- WeatherPy.ipynb                            # Weather data analysis and visualization
│   │-- VacationPy.ipynb                           # Vacation location selection and hotel mapping
│   │-- api_keys.py                                # API keys (excluded from version control)
│   │-- output_data/                               # Stores generated CSV files
│   │   ├── cities.csv                             # Stored weather data for analyzed cities
│   │   ├── City Latitude vs. Cloudiness.png
│   │   ├── City Latitude vs. Humidity.png
│   │   ├── City Latitude vs. Max Temperature.png
│   │   ├── City Latitude vs. Wind Speed.png
│   │   ├── NH Cloudiness vs. Latitude.png
│   │   ├── NH Humidity vs. Latitude.png
│   │   ├── NH Temperature vs. Latitude.png
│   │   ├── NH Wind Speed vs. Latitude.png
│   │   ├── SH Cloudiness vs. Latitude.png
│   │   ├── SH Humidity vs. Latitude.png
│   │   ├── SH Temperature vs. Latitude.png
│   │   ├── SH Wind Speed vs. Latitude.png
│-- api_keys.py                                    # API keys (excluded from version control)
│-- .gitignore                                     # Prevents sensitive files from being tracked
│-- README.md                                      # Project documentation

📌 Objective

The goal of this project is to analyze global weather patterns and identify ideal vacation destinations based on specific climate conditions. By leveraging Python, API data retrieval, and interactive mapping, this project achieves the following objectives:

1.) Weather Analysis (WeatherPy)

  • Collect real-time weather data for 500+ cities worldwide using the OpenWeatherMap API.

  • Analyze the correlation between latitude and key weather factors such as:

    • Temperature 🌡️

    • Humidity 💧

    • Cloudiness ☁️

    • Wind Speed 🌬️

  • Implement linear regression to explore trends across the Northern and Southern Hemispheres.

2.) Vacation Planning (VacationPy)

  • Filter locations based on ideal vacation weather conditions (e.g., moderate temperatures, low wind speeds, and clear skies).

  • Use the Geoapify API to find the nearest hotels for selected locations

  • Generate interactive maps to visualize vacation spots and hotel locations.

3.) Data Visualization & Insights

  • Utilize Matplotlib, SciPy, and hvPlot to create meaningful visual representations of weather trends.

  • Build interactive geographic plots using GeoViews and OpenStreetMap tiles.

By achieving these objectives, this project demonstrates how data-driven insights can be used to optimize travel planning and improve our understanding of weather patterns worldwide.


🔖 Prerequisites

Ensure you have the following installed:

  • Python 3.8+

  • Jupyter Notebook (via Anadonda or pip install notebook)

  • Pandas, Matplotlib, NumPy, Requests, SciPy

  • HvPlot, GeoViews, Cartopy, PyProj (via conda or pip in concole)

🏎️ How to Run the Project

1.) Clone the repository (or download the project files).

2.) Create a virtual environment (optional but recommended).

3.) Install dependencies if not already installed on local machine.

4.) Set up your API keys from the websites in the reference section (OpenWeatherMap API & Geoapify API).

5.) Open api_keys.pv and fill the necessary sections with your corresponding API keys.

6.) Open WeatherPy.ipynb in Jupyter Notebook and run each cell sequentially.

7.) Open VacationPy.ipynb in Jupyter Notebook and run each cell sequentially.


📚 References

This project relies on various external data sources and Python libraries:

APIs Used:

Python Libraries:

  • Pandas → For data manipulation and analysis.

  • Matplotlib → For visualizing weather trends.

  • NumPy → For numerical operations.

  • Requests → For handling API requests.

  • SciPy → For performing linear regression analysis.

  • hvPlot → For interactive plotting.

  • GeoViews → For geographic data visualization.

  • Cartopy → For map projections and spatial visualizations.

  • PyProj → For geospatial coordinate transformations.

Additional Resources


🚀 Next Steps

  • Improve data visualization using Seaborn.

  • Add historical weather analysis.

  • Implement a vacation itinerary generator.

About

Demonstrates my ability to use Python in Jupyter Notebook to pull and analyze data from an open-source API.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published